aboutsummaryrefslogtreecommitdiff
path: root/nxcomp
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2017-12-15 12:55:17 +0100
committerMihai Moldovan <ionic@ionic.de>2017-12-15 12:55:17 +0100
commit1dad092caf01d733990648e6df64cbf964df5143 (patch)
tree39de0e643e76754a3e23ca9dd0350b8ba4f76250 /nxcomp
parent6d70b9e3c47f27a166f4aacb522c5c1e49092dd9 (diff)
parent2b9025f797ee322e21077e100c2ee27c2e7fa0e0 (diff)
downloadnx-libs-1dad092caf01d733990648e6df64cbf964df5143.tar.gz
nx-libs-1dad092caf01d733990648e6df64cbf964df5143.tar.bz2
nx-libs-1dad092caf01d733990648e6df64cbf964df5143.zip
Merge branch '3.6.x'
Diffstat (limited to 'nxcomp')
-rw-r--r--nxcomp/.gitignore25
-rw-r--r--nxcomp/ActionCache.cpp39
-rw-r--r--nxcomp/ActionCacheCompat.h45
-rw-r--r--nxcomp/CHANGELOG3778
-rw-r--r--nxcomp/COPYING339
-rw-r--r--nxcomp/ChangeGCCompat.cpp131
-rw-r--r--nxcomp/ChangeGCCompat.h170
-rw-r--r--nxcomp/Colormap.h24
-rw-r--r--nxcomp/CreatePixmapCompat.cpp272
-rw-r--r--nxcomp/CreatePixmapCompat.h154
-rw-r--r--nxcomp/Fork.h23
-rw-r--r--nxcomp/FreeCache.h34
-rw-r--r--nxcomp/LICENSE37
-rw-r--r--nxcomp/Makefile.am21
-rw-r--r--nxcomp/Makefile.in279
-rw-r--r--nxcomp/PositionCacheCompat.cpp45
-rw-r--r--nxcomp/PositionCacheCompat.h41
-rw-r--r--nxcomp/README21
-rw-r--r--nxcomp/README-IPAQ21
-rw-r--r--nxcomp/RenderCompositeCompat.cpp320
-rw-r--r--nxcomp/RenderCompositeCompat.h80
-rw-r--r--nxcomp/RenderCompositeGlyphsCompat.cpp602
-rw-r--r--nxcomp/RenderCompositeGlyphsCompat.h80
-rw-r--r--nxcomp/RenderCreateGlyphSetCompat.cpp231
-rw-r--r--nxcomp/RenderCreateGlyphSetCompat.h80
-rw-r--r--nxcomp/RenderCreatePictureCompat.cpp262
-rw-r--r--nxcomp/RenderCreatePictureCompat.h80
-rw-r--r--nxcomp/RenderFreePictureCompat.cpp158
-rw-r--r--nxcomp/RenderFreePictureCompat.h80
-rw-r--r--nxcomp/RenderPictureClipCompat.cpp237
-rw-r--r--nxcomp/RenderPictureClipCompat.h80
-rw-r--r--nxcomp/SetUnpackAlphaCompat.cpp250
-rw-r--r--nxcomp/SetUnpackAlphaCompat.h149
-rw-r--r--nxcomp/SetUnpackColormapCompat.cpp262
-rw-r--r--nxcomp/SetUnpackColormapCompat.h149
-rw-r--r--nxcomp/TextCompressor.cpp77
-rw-r--r--nxcomp/TextCompressor.h49
-rw-r--r--nxcomp/Utils.cpp35
l---------[-rw-r--r--]nxcomp/VERSION2
-rw-r--r--nxcomp/XidCache.cpp39
-rw-r--r--nxcomp/configure.ac118
-rw-r--r--nxcomp/configure.in393
-rw-r--r--nxcomp/include/MD5.h (renamed from nxcomp/MD5.h)0
-rw-r--r--nxcomp/include/NX.h (renamed from nxcomp/NX.h)36
-rw-r--r--nxcomp/include/NXalert.h (renamed from nxcomp/NXalert.h)22
-rw-r--r--nxcomp/include/NXpack.h (renamed from nxcomp/NXpack.h)22
-rw-r--r--nxcomp/include/NXproto.h (renamed from nxcomp/NXproto.h)22
-rw-r--r--nxcomp/include/NXvars.h (renamed from nxcomp/NXvars.h)22
-rwxr-xr-xnxcomp/install-sh238
l---------nxcomp/m4/ax_cxx_compile_stdcxx.m41
l---------nxcomp/m4/ax_cxx_compile_stdcxx_11.m41
l---------nxcomp/m4/ax_pthread.m41
l---------nxcomp/m4/nx-macros.m41
-rwxr-xr-xnxcomp/mkinstalldirs34
-rw-r--r--nxcomp/nxcomp.pc.in15
-rw-r--r--nxcomp/src/ActionCache.cpp51
-rw-r--r--nxcomp/src/ActionCache.h (renamed from nxcomp/ActionCache.h)22
-rw-r--r--nxcomp/src/Agent.cpp (renamed from nxcomp/Agent.cpp)26
-rw-r--r--nxcomp/src/Agent.h (renamed from nxcomp/Agent.h)50
-rw-r--r--nxcomp/src/Alpha.cpp (renamed from nxcomp/Alpha.cpp)26
-rw-r--r--nxcomp/src/Alpha.h (renamed from nxcomp/Alpha.h)22
-rw-r--r--nxcomp/src/Auth.cpp (renamed from nxcomp/Auth.cpp)69
-rw-r--r--nxcomp/src/Auth.h (renamed from nxcomp/Auth.h)22
-rw-r--r--nxcomp/src/Bitmap.cpp (renamed from nxcomp/Bitmap.cpp)26
-rw-r--r--nxcomp/src/Bitmap.h (renamed from nxcomp/Bitmap.h)22
-rw-r--r--nxcomp/src/BlockCache.cpp (renamed from nxcomp/BlockCache.cpp)26
-rw-r--r--nxcomp/src/BlockCache.h (renamed from nxcomp/BlockCache.h)22
-rw-r--r--nxcomp/src/BlockCacheSet.cpp (renamed from nxcomp/BlockCacheSet.cpp)26
-rw-r--r--nxcomp/src/BlockCacheSet.h (renamed from nxcomp/BlockCacheSet.h)22
-rw-r--r--nxcomp/src/ChangeGC.cpp (renamed from nxcomp/ChangeGC.cpp)26
-rw-r--r--nxcomp/src/ChangeGC.h (renamed from nxcomp/ChangeGC.h)22
-rw-r--r--nxcomp/src/ChangeProperty.cpp (renamed from nxcomp/ChangeProperty.cpp)26
-rw-r--r--nxcomp/src/ChangeProperty.h (renamed from nxcomp/ChangeProperty.h)22
-rw-r--r--nxcomp/src/Channel.cpp (renamed from nxcomp/Channel.cpp)216
-rw-r--r--nxcomp/src/Channel.h (renamed from nxcomp/Channel.h)24
-rw-r--r--nxcomp/src/ChannelCache.cpp (renamed from nxcomp/ChannelCache.cpp)26
-rw-r--r--nxcomp/src/ChannelCache.h (renamed from nxcomp/ChannelCache.h)29
-rw-r--r--nxcomp/src/ChannelEndPoint.cpp363
-rw-r--r--nxcomp/src/ChannelEndPoint.h72
-rw-r--r--nxcomp/src/ChannelStore.h (renamed from nxcomp/ChannelStore.h)22
-rw-r--r--nxcomp/src/CharCache.cpp (renamed from nxcomp/CharCache.cpp)26
-rw-r--r--nxcomp/src/CharCache.h (renamed from nxcomp/CharCache.h)22
-rw-r--r--nxcomp/src/Children.cpp (renamed from nxcomp/Children.cpp)169
-rw-r--r--nxcomp/src/ClearArea.cpp (renamed from nxcomp/ClearArea.cpp)28
-rw-r--r--nxcomp/src/ClearArea.h (renamed from nxcomp/ClearArea.h)22
-rw-r--r--nxcomp/src/ClientCache.cpp (renamed from nxcomp/ClientCache.cpp)35
-rw-r--r--nxcomp/src/ClientCache.h (renamed from nxcomp/ClientCache.h)42
-rw-r--r--nxcomp/src/ClientChannel.cpp (renamed from nxcomp/ClientChannel.cpp)601
-rw-r--r--nxcomp/src/ClientChannel.h (renamed from nxcomp/ClientChannel.h)62
-rw-r--r--nxcomp/src/ClientProxy.cpp (renamed from nxcomp/ClientProxy.cpp)47
-rw-r--r--nxcomp/src/ClientProxy.h (renamed from nxcomp/ClientProxy.h)39
-rw-r--r--nxcomp/src/ClientReadBuffer.cpp (renamed from nxcomp/ClientReadBuffer.cpp)28
-rw-r--r--nxcomp/src/ClientReadBuffer.h (renamed from nxcomp/ClientReadBuffer.h)22
-rw-r--r--nxcomp/src/ClientStore.cpp (renamed from nxcomp/ClientStore.cpp)50
-rw-r--r--nxcomp/src/ClientStore.h (renamed from nxcomp/ClientStore.h)22
-rw-r--r--nxcomp/src/Colormap.cpp (renamed from nxcomp/Colormap.cpp)26
-rw-r--r--nxcomp/src/Colormap.h32
-rw-r--r--nxcomp/src/ConfigureWindow.cpp (renamed from nxcomp/ConfigureWindow.cpp)26
-rw-r--r--nxcomp/src/ConfigureWindow.h (renamed from nxcomp/ConfigureWindow.h)22
-rw-r--r--nxcomp/src/Control.cpp (renamed from nxcomp/Control.cpp)176
-rw-r--r--nxcomp/src/Control.h (renamed from nxcomp/Control.h)81
-rw-r--r--nxcomp/src/CopyArea.cpp (renamed from nxcomp/CopyArea.cpp)26
-rw-r--r--nxcomp/src/CopyArea.h (renamed from nxcomp/CopyArea.h)22
-rw-r--r--nxcomp/src/CreateGC.cpp (renamed from nxcomp/CreateGC.cpp)106
-rw-r--r--nxcomp/src/CreateGC.h (renamed from nxcomp/CreateGC.h)22
-rw-r--r--nxcomp/src/CreatePixmap.cpp (renamed from nxcomp/CreatePixmap.cpp)26
-rw-r--r--nxcomp/src/CreatePixmap.h (renamed from nxcomp/CreatePixmap.h)22
-rw-r--r--nxcomp/src/DecodeBuffer.cpp (renamed from nxcomp/DecodeBuffer.cpp)121
-rw-r--r--nxcomp/src/DecodeBuffer.h (renamed from nxcomp/DecodeBuffer.h)34
-rw-r--r--nxcomp/src/EncodeBuffer.cpp (renamed from nxcomp/EncodeBuffer.cpp)97
-rw-r--r--nxcomp/src/EncodeBuffer.h (renamed from nxcomp/EncodeBuffer.h)34
-rw-r--r--nxcomp/src/FillPoly.cpp (renamed from nxcomp/FillPoly.cpp)42
-rw-r--r--nxcomp/src/FillPoly.h (renamed from nxcomp/FillPoly.h)38
-rw-r--r--nxcomp/src/Fork.cpp (renamed from nxcomp/Fork.cpp)26
-rw-r--r--nxcomp/src/Fork.h31
-rw-r--r--nxcomp/src/FreeCache.h42
-rw-r--r--nxcomp/src/GenericChannel.cpp (renamed from nxcomp/GenericChannel.cpp)28
-rw-r--r--nxcomp/src/GenericChannel.h (renamed from nxcomp/GenericChannel.h)46
-rw-r--r--nxcomp/src/GenericReadBuffer.cpp (renamed from nxcomp/GenericReadBuffer.cpp)26
-rw-r--r--nxcomp/src/GenericReadBuffer.h (renamed from nxcomp/GenericReadBuffer.h)22
-rw-r--r--nxcomp/src/GenericReply.cpp (renamed from nxcomp/GenericReply.cpp)33
-rw-r--r--nxcomp/src/GenericReply.h (renamed from nxcomp/GenericReply.h)23
-rw-r--r--nxcomp/src/GenericRequest.cpp (renamed from nxcomp/GenericRequest.cpp)35
-rw-r--r--nxcomp/src/GenericRequest.h (renamed from nxcomp/GenericRequest.h)23
-rw-r--r--nxcomp/src/GetImage.cpp (renamed from nxcomp/GetImage.cpp)26
-rw-r--r--nxcomp/src/GetImage.h (renamed from nxcomp/GetImage.h)22
-rw-r--r--nxcomp/src/GetImageReply.cpp (renamed from nxcomp/GetImageReply.cpp)33
-rw-r--r--nxcomp/src/GetImageReply.h (renamed from nxcomp/GetImageReply.h)23
-rw-r--r--nxcomp/src/GetProperty.cpp (renamed from nxcomp/GetProperty.cpp)26
-rw-r--r--nxcomp/src/GetProperty.h (renamed from nxcomp/GetProperty.h)22
-rw-r--r--nxcomp/src/GetPropertyReply.cpp (renamed from nxcomp/GetPropertyReply.cpp)33
-rw-r--r--nxcomp/src/GetPropertyReply.h (renamed from nxcomp/GetPropertyReply.h)23
-rw-r--r--nxcomp/src/ImageText16.cpp (renamed from nxcomp/ImageText16.cpp)26
-rw-r--r--nxcomp/src/ImageText16.h (renamed from nxcomp/ImageText16.h)22
-rw-r--r--nxcomp/src/ImageText8.cpp (renamed from nxcomp/ImageText8.cpp)26
-rw-r--r--nxcomp/src/ImageText8.h (renamed from nxcomp/ImageText8.h)22
-rw-r--r--nxcomp/src/IntCache.cpp (renamed from nxcomp/IntCache.cpp)26
-rw-r--r--nxcomp/src/IntCache.h (renamed from nxcomp/IntCache.h)22
-rw-r--r--nxcomp/src/InternAtom.cpp (renamed from nxcomp/InternAtom.cpp)26
-rw-r--r--nxcomp/src/InternAtom.h (renamed from nxcomp/InternAtom.h)22
-rw-r--r--nxcomp/src/Jpeg.cpp (renamed from nxcomp/Jpeg.cpp)39
-rw-r--r--nxcomp/src/Jpeg.h (renamed from nxcomp/Jpeg.h)22
-rw-r--r--nxcomp/src/Keeper.cpp (renamed from nxcomp/Keeper.cpp)26
-rw-r--r--nxcomp/src/Keeper.h (renamed from nxcomp/Keeper.h)22
-rw-r--r--nxcomp/src/List.cpp (renamed from nxcomp/List.cpp)26
-rw-r--r--nxcomp/src/List.h (renamed from nxcomp/List.h)22
-rw-r--r--nxcomp/src/ListFontsReply.cpp (renamed from nxcomp/ListFontsReply.cpp)33
-rw-r--r--nxcomp/src/ListFontsReply.h (renamed from nxcomp/ListFontsReply.h)23
-rw-r--r--nxcomp/src/Log.cpp121
-rw-r--r--nxcomp/src/Log.h559
-rw-r--r--nxcomp/src/Loop.cpp (renamed from nxcomp/Loop.cpp)6365
-rw-r--r--nxcomp/src/MD5.c (renamed from nxcomp/MD5.c)4
-rw-r--r--nxcomp/src/Makefile.am153
-rw-r--r--nxcomp/src/Message.cpp (renamed from nxcomp/Message.cpp)44
-rw-r--r--nxcomp/src/Message.h (renamed from nxcomp/Message.h)43
-rw-r--r--nxcomp/src/Misc.cpp (renamed from nxcomp/Misc.cpp)115
-rw-r--r--nxcomp/src/Misc.h (renamed from nxcomp/Misc.h)38
-rw-r--r--nxcomp/src/NXmitshm.h (renamed from nxcomp/NXmitshm.h)22
-rw-r--r--nxcomp/src/NXrender.h (renamed from nxcomp/NXrender.h)22
-rw-r--r--nxcomp/src/OpcodeCache.h (renamed from nxcomp/OpcodeCache.h)22
-rw-r--r--nxcomp/src/OpcodeStore.cpp (renamed from nxcomp/OpcodeStore.cpp)26
-rw-r--r--nxcomp/src/OpcodeStore.h (renamed from nxcomp/OpcodeStore.h)22
-rw-r--r--nxcomp/src/Pack.c (renamed from nxcomp/Pack.c)22
-rw-r--r--nxcomp/src/Pgn.cpp (renamed from nxcomp/Pgn.cpp)35
-rw-r--r--nxcomp/src/Pgn.h (renamed from nxcomp/Pgn.h)22
-rw-r--r--nxcomp/src/Pipe.cpp (renamed from nxcomp/Pipe.cpp)45
-rw-r--r--nxcomp/src/Pipe.h (renamed from nxcomp/Pipe.h)22
-rw-r--r--nxcomp/src/PolyArc.cpp (renamed from nxcomp/PolyArc.cpp)26
-rw-r--r--nxcomp/src/PolyArc.h (renamed from nxcomp/PolyArc.h)22
-rw-r--r--nxcomp/src/PolyFillArc.cpp (renamed from nxcomp/PolyFillArc.cpp)26
-rw-r--r--nxcomp/src/PolyFillArc.h (renamed from nxcomp/PolyFillArc.h)22
-rw-r--r--nxcomp/src/PolyFillRectangle.cpp (renamed from nxcomp/PolyFillRectangle.cpp)26
-rw-r--r--nxcomp/src/PolyFillRectangle.h (renamed from nxcomp/PolyFillRectangle.h)22
-rw-r--r--nxcomp/src/PolyLine.cpp (renamed from nxcomp/PolyLine.cpp)44
-rw-r--r--nxcomp/src/PolyLine.h (renamed from nxcomp/PolyLine.h)22
-rw-r--r--nxcomp/src/PolyPoint.cpp (renamed from nxcomp/PolyPoint.cpp)44
-rw-r--r--nxcomp/src/PolyPoint.h (renamed from nxcomp/PolyPoint.h)22
-rw-r--r--nxcomp/src/PolySegment.cpp (renamed from nxcomp/PolySegment.cpp)26
-rw-r--r--nxcomp/src/PolySegment.h (renamed from nxcomp/PolySegment.h)22
-rw-r--r--nxcomp/src/PolyText16.cpp (renamed from nxcomp/PolyText16.cpp)26
-rw-r--r--nxcomp/src/PolyText16.h (renamed from nxcomp/PolyText16.h)22
-rw-r--r--nxcomp/src/PolyText8.cpp (renamed from nxcomp/PolyText8.cpp)26
-rw-r--r--nxcomp/src/PolyText8.h (renamed from nxcomp/PolyText8.h)22
-rw-r--r--nxcomp/src/Proxy.cpp (renamed from nxcomp/Proxy.cpp)775
-rw-r--r--nxcomp/src/Proxy.h (renamed from nxcomp/Proxy.h)49
-rw-r--r--nxcomp/src/ProxyReadBuffer.cpp (renamed from nxcomp/ProxyReadBuffer.cpp)28
-rw-r--r--nxcomp/src/ProxyReadBuffer.h (renamed from nxcomp/ProxyReadBuffer.h)22
-rw-r--r--nxcomp/src/PutImage.cpp (renamed from nxcomp/PutImage.cpp)40
-rw-r--r--nxcomp/src/PutImage.h (renamed from nxcomp/PutImage.h)24
-rw-r--r--nxcomp/src/PutPackedImage.cpp (renamed from nxcomp/PutPackedImage.cpp)33
-rw-r--r--nxcomp/src/PutPackedImage.h (renamed from nxcomp/PutPackedImage.h)23
-rw-r--r--nxcomp/src/QueryFontReply.cpp (renamed from nxcomp/QueryFontReply.cpp)33
-rw-r--r--nxcomp/src/QueryFontReply.h (renamed from nxcomp/QueryFontReply.h)23
-rw-r--r--nxcomp/src/ReadBuffer.cpp (renamed from nxcomp/ReadBuffer.cpp)26
-rw-r--r--nxcomp/src/ReadBuffer.h (renamed from nxcomp/ReadBuffer.h)22
-rw-r--r--nxcomp/src/RenderAddGlyphs.cpp (renamed from nxcomp/RenderAddGlyphs.cpp)26
-rw-r--r--nxcomp/src/RenderAddGlyphs.h (renamed from nxcomp/RenderAddGlyphs.h)22
-rw-r--r--nxcomp/src/RenderChangePicture.cpp (renamed from nxcomp/RenderChangePicture.cpp)26
-rw-r--r--nxcomp/src/RenderChangePicture.h (renamed from nxcomp/RenderChangePicture.h)22
-rw-r--r--nxcomp/src/RenderComposite.cpp (renamed from nxcomp/RenderComposite.cpp)26
-rw-r--r--nxcomp/src/RenderComposite.h (renamed from nxcomp/RenderComposite.h)22
-rw-r--r--nxcomp/src/RenderCompositeGlyphs.cpp (renamed from nxcomp/RenderCompositeGlyphs.cpp)192
-rw-r--r--nxcomp/src/RenderCompositeGlyphs.h (renamed from nxcomp/RenderCompositeGlyphs.h)27
-rw-r--r--nxcomp/src/RenderCreateGlyphSet.cpp (renamed from nxcomp/RenderCreateGlyphSet.cpp)26
-rw-r--r--nxcomp/src/RenderCreateGlyphSet.h (renamed from nxcomp/RenderCreateGlyphSet.h)22
-rw-r--r--nxcomp/src/RenderCreatePicture.cpp (renamed from nxcomp/RenderCreatePicture.cpp)26
-rw-r--r--nxcomp/src/RenderCreatePicture.h (renamed from nxcomp/RenderCreatePicture.h)22
-rw-r--r--nxcomp/src/RenderExtension.cpp (renamed from nxcomp/RenderExtension.cpp)284
-rw-r--r--nxcomp/src/RenderExtension.h (renamed from nxcomp/RenderExtension.h)30
-rw-r--r--nxcomp/src/RenderFillRectangles.cpp (renamed from nxcomp/RenderFillRectangles.cpp)26
-rw-r--r--nxcomp/src/RenderFillRectangles.h (renamed from nxcomp/RenderFillRectangles.h)22
-rw-r--r--nxcomp/src/RenderFreeGlyphSet.cpp (renamed from nxcomp/RenderFreeGlyphSet.cpp)26
-rw-r--r--nxcomp/src/RenderFreeGlyphSet.h (renamed from nxcomp/RenderFreeGlyphSet.h)22
-rw-r--r--nxcomp/src/RenderFreePicture.cpp (renamed from nxcomp/RenderFreePicture.cpp)26
-rw-r--r--nxcomp/src/RenderFreePicture.h (renamed from nxcomp/RenderFreePicture.h)22
-rw-r--r--nxcomp/src/RenderGenericRequest.cpp (renamed from nxcomp/RenderGenericRequest.cpp)26
-rw-r--r--nxcomp/src/RenderGenericRequest.h (renamed from nxcomp/RenderGenericRequest.h)22
-rw-r--r--nxcomp/src/RenderMinorExtensionHeaders.h (renamed from nxcomp/RenderMinorExtensionHeaders.h)22
-rw-r--r--nxcomp/src/RenderMinorExtensionMethods.h (renamed from nxcomp/RenderMinorExtensionMethods.h)22
-rw-r--r--nxcomp/src/RenderMinorExtensionTags.h (renamed from nxcomp/RenderMinorExtensionTags.h)22
-rw-r--r--nxcomp/src/RenderPictureClip.cpp (renamed from nxcomp/RenderPictureClip.cpp)26
-rw-r--r--nxcomp/src/RenderPictureClip.h (renamed from nxcomp/RenderPictureClip.h)22
-rw-r--r--nxcomp/src/RenderPictureFilter.cpp (renamed from nxcomp/RenderPictureFilter.cpp)26
-rw-r--r--nxcomp/src/RenderPictureFilter.h (renamed from nxcomp/RenderPictureFilter.h)22
-rw-r--r--nxcomp/src/RenderPictureTransform.cpp (renamed from nxcomp/RenderPictureTransform.cpp)26
-rw-r--r--nxcomp/src/RenderPictureTransform.h (renamed from nxcomp/RenderPictureTransform.h)22
-rw-r--r--nxcomp/src/RenderTrapezoids.cpp (renamed from nxcomp/RenderTrapezoids.cpp)26
-rw-r--r--nxcomp/src/RenderTrapezoids.h (renamed from nxcomp/RenderTrapezoids.h)22
-rw-r--r--nxcomp/src/RenderTriangles.cpp (renamed from nxcomp/RenderTriangles.cpp)26
-rw-r--r--nxcomp/src/RenderTriangles.h (renamed from nxcomp/RenderTriangles.h)22
-rw-r--r--nxcomp/src/Rgb.cpp (renamed from nxcomp/Rgb.cpp)26
-rw-r--r--nxcomp/src/Rgb.h (renamed from nxcomp/Rgb.h)22
-rw-r--r--nxcomp/src/Rle.cpp (renamed from nxcomp/Rle.cpp)26
-rw-r--r--nxcomp/src/Rle.h (renamed from nxcomp/Rle.h)22
-rw-r--r--nxcomp/src/SendEvent.cpp (renamed from nxcomp/SendEvent.cpp)26
-rw-r--r--nxcomp/src/SendEvent.h (renamed from nxcomp/SendEvent.h)22
-rw-r--r--nxcomp/src/SequenceQueue.cpp (renamed from nxcomp/SequenceQueue.cpp)26
-rw-r--r--nxcomp/src/SequenceQueue.h (renamed from nxcomp/SequenceQueue.h)22
-rw-r--r--nxcomp/src/ServerCache.cpp (renamed from nxcomp/ServerCache.cpp)31
-rw-r--r--nxcomp/src/ServerCache.h (renamed from nxcomp/ServerCache.h)32
-rw-r--r--nxcomp/src/ServerChannel.cpp (renamed from nxcomp/ServerChannel.cpp)796
-rw-r--r--nxcomp/src/ServerChannel.h (renamed from nxcomp/ServerChannel.h)37
-rw-r--r--nxcomp/src/ServerProxy.cpp (renamed from nxcomp/ServerProxy.cpp)50
-rw-r--r--nxcomp/src/ServerProxy.h (renamed from nxcomp/ServerProxy.h)49
-rw-r--r--nxcomp/src/ServerReadBuffer.cpp (renamed from nxcomp/ServerReadBuffer.cpp)28
-rw-r--r--nxcomp/src/ServerReadBuffer.h (renamed from nxcomp/ServerReadBuffer.h)22
-rw-r--r--nxcomp/src/ServerStore.cpp (renamed from nxcomp/ServerStore.cpp)26
-rw-r--r--nxcomp/src/ServerStore.h (renamed from nxcomp/ServerStore.h)22
-rw-r--r--nxcomp/src/SetClipRectangles.cpp (renamed from nxcomp/SetClipRectangles.cpp)26
-rw-r--r--nxcomp/src/SetClipRectangles.h (renamed from nxcomp/SetClipRectangles.h)22
-rw-r--r--nxcomp/src/SetUnpackAlpha.cpp (renamed from nxcomp/SetUnpackAlpha.cpp)33
-rw-r--r--nxcomp/src/SetUnpackAlpha.h (renamed from nxcomp/SetUnpackAlpha.h)26
-rw-r--r--nxcomp/src/SetUnpackColormap.cpp (renamed from nxcomp/SetUnpackColormap.cpp)33
-rw-r--r--nxcomp/src/SetUnpackColormap.h (renamed from nxcomp/SetUnpackColormap.h)25
-rw-r--r--nxcomp/src/SetUnpackGeometry.cpp (renamed from nxcomp/SetUnpackGeometry.cpp)26
-rw-r--r--nxcomp/src/SetUnpackGeometry.h (renamed from nxcomp/SetUnpackGeometry.h)22
-rw-r--r--nxcomp/src/ShapeExtension.cpp (renamed from nxcomp/ShapeExtension.cpp)33
-rw-r--r--nxcomp/src/ShapeExtension.h (renamed from nxcomp/ShapeExtension.h)23
-rw-r--r--nxcomp/src/Socket.cpp (renamed from nxcomp/Socket.cpp)26
-rw-r--r--nxcomp/src/Socket.h (renamed from nxcomp/Socket.h)32
-rw-r--r--nxcomp/src/Split.cpp (renamed from nxcomp/Split.cpp)51
-rw-r--r--nxcomp/src/Split.h (renamed from nxcomp/Split.h)22
-rw-r--r--nxcomp/src/StaticCompressor.cpp (renamed from nxcomp/StaticCompressor.cpp)26
-rw-r--r--nxcomp/src/StaticCompressor.h (renamed from nxcomp/StaticCompressor.h)22
-rw-r--r--nxcomp/src/Statistics.cpp (renamed from nxcomp/Statistics.cpp)32
-rw-r--r--nxcomp/src/Statistics.h (renamed from nxcomp/Statistics.h)22
-rw-r--r--nxcomp/src/Timestamp.cpp (renamed from nxcomp/Timestamp.cpp)26
-rw-r--r--nxcomp/src/Timestamp.h (renamed from nxcomp/Timestamp.h)26
-rw-r--r--nxcomp/src/TranslateCoords.cpp (renamed from nxcomp/TranslateCoords.cpp)26
-rw-r--r--nxcomp/src/TranslateCoords.h (renamed from nxcomp/TranslateCoords.h)22
-rw-r--r--nxcomp/src/Transport.cpp (renamed from nxcomp/Transport.cpp)34
-rw-r--r--nxcomp/src/Transport.h (renamed from nxcomp/Transport.h)28
-rw-r--r--nxcomp/src/Types.h (renamed from nxcomp/Types.h)42
-rw-r--r--nxcomp/src/Unpack.cpp (renamed from nxcomp/Unpack.cpp)26
-rw-r--r--nxcomp/src/Unpack.h (renamed from nxcomp/Unpack.h)22
-rw-r--r--nxcomp/src/Vars.c (renamed from nxcomp/Vars.c)22
-rw-r--r--nxcomp/src/Version.c101
-rw-r--r--nxcomp/src/WriteBuffer.cpp (renamed from nxcomp/WriteBuffer.cpp)26
-rw-r--r--nxcomp/src/WriteBuffer.h (renamed from nxcomp/WriteBuffer.h)22
-rw-r--r--nxcomp/src/XidCache.cpp51
-rw-r--r--nxcomp/src/XidCache.h (renamed from nxcomp/XidCache.h)22
-rw-r--r--nxcomp/src/Z.cpp (renamed from nxcomp/Z.cpp)26
-rw-r--r--nxcomp/src/Z.h (renamed from nxcomp/Z.h)22
-rw-r--r--nxcomp/test/Makefile.am22
-rw-r--r--nxcomp/test/logging_test.cpp224
-rw-r--r--nxcomp/test/logging_test.h121
286 files changed, 9852 insertions, 17460 deletions
diff --git a/nxcomp/.gitignore b/nxcomp/.gitignore
new file mode 100644
index 000000000..1d00b755b
--- /dev/null
+++ b/nxcomp/.gitignore
@@ -0,0 +1,25 @@
+Makefile
+Makefile.in
+aclocal.m4
+compile
+config.guess
+config.sub
+depcomp
+install-sh
+ltmain.sh
+missing
+config.h
+config.h.in
+libtool
+m4/libtool.m4
+m4/ltoptions.m4
+m4/ltsugar.m4
+m4/ltversion.m4
+m4/lt~obsolete.m4
+nxcomp.pc
+src/Makefile
+src/Makefile.in
+test/.deps/
+test/Makefile
+test/Makefile.in
+test/logging_test
diff --git a/nxcomp/ActionCache.cpp b/nxcomp/ActionCache.cpp
deleted file mode 100644
index 79b670021..000000000
--- a/nxcomp/ActionCache.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#include "Control.h"
-
-#include "ActionCache.h"
-
-ActionCache::ActionCache()
-{
- for (int i = 0; i < 256; i++)
- {
- base_[i] = new IntCache(8);
- }
-
- slot_ = 0;
- last_ = 0;
-}
-
-ActionCache::~ActionCache()
-{
- for (int i = 0; i < 256; i++)
- {
- delete base_[i];
- }
-}
diff --git a/nxcomp/ActionCacheCompat.h b/nxcomp/ActionCacheCompat.h
deleted file mode 100644
index 8281db826..000000000
--- a/nxcomp/ActionCacheCompat.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef ActionCacheCompat_H
-#define ActionCacheCompat_H
-
-#include "CharCache.h"
-
-class ActionCacheCompat
-{
- friend class EncodeBuffer;
- friend class DecodeBuffer;
-
- public:
-
- ActionCacheCompat()
- {
- slot_ = 0;
- }
-
- ~ActionCacheCompat()
- {
- }
-
- private:
-
- CharCache base_[4];
- unsigned char slot_;
-};
-
-#endif /* ActionCacheCompat_H */
diff --git a/nxcomp/CHANGELOG b/nxcomp/CHANGELOG
deleted file mode 100644
index b7ef0d97a..000000000
--- a/nxcomp/CHANGELOG
+++ /dev/null
@@ -1,3778 +0,0 @@
-ChangeLog:
-
-nxcomp-3.5.0-2
-
-- Fixed TR11H02398. Solved a race condition when creating channels.
-
-nxcomp-3.5.0-1
-
-- Opened the 3.5.0 branch based on nxcomp-3.4.0-7.
-
-- Updated copyright to year 2011.
-
-nxcomp-3.4.0-7
-
-- Fixed TR03H02334. Modified the UNIX domain socket checks on MacOSX
- to be compliant with the standard introduced in OSX 10.6.3.
-
-nxcomp-3.4.0-6
-
-- Solved compilation problems on Solaris.
-
-nxcomp-3.4.0-5
-
-- Solved compilation problems on GCC 4.4.
-
-nxcomp-3.4.0-4
-
-- Added reference to fixed TR02H02325.
-
-nxcomp-3.4.0-3
-
-- Updated copyright to year 2010.
-
-nxcomp-3.4.0-2
-
-- Fixed TR03G02204. Changed the parsing of X authority entries in
- order to handle the case where the hostname includes white spaces.
-
-- Fixed TR02H02325. Bug in PNG decompression on 16bpp displays.
-
-nxcomp-3.4.0-1
-
-- Opened the 3.4.0 branch based on nxcomp-3.3.0-4.
-
-- Changed version number.
-
-- Updated copyright to year 2009.
-
-nxcomp-3.3.0-4
-
-- Check if the variable storing the ping time exceeded the maximum
- integer value.
-
-- Recover incorrect sequence number when the proxy is not connected
- to an agent.
-
-nxcomp-3.3.0-3
-
-- Removed a condition in ClientChannel that caused a loss in event
- sequence numbers.
-
-nxcomp-3.3.0-2
-
-- Updated VERSION.
-
-nxcomp-3.3.0-1
-
-- Opened the 3.3.0 branch based on nxcomp-3.2.0-7.
-
-nxcomp-3.2.0-7
-
-- Solved a compilation problem on GCC 4.3.
-
-nxcomp-3.2.0-6
-
-- Changes considering that unsetenv() returns void on Mac OS X.
-
-nxcomp-3.2.0-5
-
-- Fixed TR03F02024. Assume the launchd unix socket as X socket.
-
-- Changed the authorization cookie retrieval when using the launchd
- socket on MacOSX, in order to wait for the X server start.
-
-nxcomp-3.2.0-4
-
-- Fixed TR03F02026. Unset environment variable LD_LIBRARY_PATH before
- calling the exec function running nxclient.
-
-nxcomp-3.2.0-3
-
-- Fix addMsTimestamp() and subMsTimestamp(). Remove the check for
- a valid input in diffTimestamp() and diffUsTimestamp().
-
-nxcomp-3.2.0-2
-
-- Fixed TR12E01973. Now the correct number of bits are used for the
- number of points in a X_FillPoly request.
-
-nxcomp-3.2.0-1
-
-- Opened the 3.2.0 branch based on nxcomp-3.1.0-6.
-
-nxcomp-3.1.0-6
-
-- Always use a timeout of 50 ms to update the congestion counter.
-
-nxcomp-3.1.0-5
-
-- Solve the possible deadlock caused by both proxies running out of
- tokens at the same time.
-
-- In ServerProxy::handleCheckDrop() copy the list since the function
- can delete the elements.
-
-nxcomp-3.1.0-4
-
-- Classes ProxyReadBuffer and ServerReadBuffer returned an invalid
- number of characters to read in the case of a readable() failure.
-
-- Connections to proxy versions newer than 3.0.0 were not accepted.
-
-- Reading options from file could fail if options contained spaces
- or other characters interrupting the fscanf()'s matching of input.
-
-- The proxy link could not be flushed if a ping request was replied
- after the end of the read loop.
-
-nxcomp-3.1.0-3
-
-- Fixed a compilation warning on GCC 2.95.
-
-nxcomp-3.1.0-2
-
-- Solved TR09E01852. Modified the encoding of the number of rects
- in the XSetClipRectangles request.
-
-nxcomp-3.1.0-1
-
-- Opened the 3.1.0 branch based on nxcomp-3.0.0-46.
-
-nxcomp-3.0.0-46
-
-- Fixed TR09E01865 and TR08E01831. Assume the old behavior of compr-
- essing the CUPS, SMB, HTTP and Font channels when connected to an
- old proxy version.
-
-nxcomp-3.0.0-45
-
-- Retry the fork() 30 times, but only on Cygwin (Sob!).
-
-nxcomp-3.0.0-44
-
-- In the case of an error, try again to fork() after a second, for
- a maximum of 5 times. This seems to constitute a valid workaround
- to the intermittent fork() failures observed on Windows.
-
-- Fixed NXTransDestroy() to show the 'broken connection' dialog in
- the case of a link failure on the client.
-
-- Handled the 'terminating' and 'terminated' messages as new proxy
- stages.
-
-- Force all the directories and files created by the library to be
- readable only by the user.
-
-- Don't complain if the shared memory segment can't be initialized
- on Windows.
-
-nxcomp-3.0.0-43
-
-- Prevent the reallocation of the read buffer in the proxy and the
- agent transport if the buffer was borrowed by an upper layer.
-
-- Let the house-keeping process remove the cache directories that
- are empty and have not be used since more than 30 days.
-
-- Added the missing destruction of the ZLIB stream used for image
- decompression at proxy shutdown.
-
-nxcomp-3.0.0-42
-
-- In handleFastWriteReply(), moved the initialization of the 'next'
- pointer inside the '#ifndef __sun' block. This should fix the re-
- maining encoding problems on SPARCs.
-
-nxcomp-3.0.0-41
-
-- VMWare virtual machines can have the system timer deadly broken.
- In the case of timeout, try to send a ping regardless we are the
- client or the server proxy to force a write by the remote.
-
-- Removed the messages 'Info: Using image cache parameters...' and
- 'Info: Using image streaming parameters...' from the session log
- if the image cache is not enabled.
-
-nxcomp-3.0.0-40
-
-- Removed the messages 'Info: Shutting down the NX transport' and
- 'Info: End of NX transport requested by...' at the session tear
- down.
-
-- Removed the remaining log output.
-
-nxcomp-3.0.0-39
-
-- Don't reset the timer on proxy shutdown.
-
-nxcomp-3.0.0-38
-
-- Don't reinstall the signal handler if the signal was enabled and
- the NXTransSignal() action is NX_SIGNAL_FORWARD.
-
-nxcomp-3.0.0-37
-
-- Return a congestion level 9 if the agent channel is in congestion
- state.
-
-- Set the idle timeout (used to update the congestion state) based
- on the link type. The timeout is 0 ms with link LAN and 50 ms in
- the case of MODEM, with the other values in the between.
-
-nxcomp-3.0.0-36
-
-- Changed the encoding of the RenderCompositeGlyphs requests. Use
- a separate cache for X and Y. Send a single bit for offset X and
- offset Y if they match the source coordinates.
-
-- Always use the memcpy() in the handleFastWrite*() on Sun, as the
- alternative code doesn't work on SPARC if the buffer is not word
- aligned.
-
-nxcomp-3.0.0-35
-
-- Ensure a smooth transition between different congestion states.
- If the current congestion counter is greater than the previous,
- ramp up the value quickly by taking the current counter. If the
- new congestion counter is less than the previous, ramp down the
- reported value slowly by calculating the average of the last 8
- updates. Reset the congestion counter to 0 if no token reply is
- pending and the proxy is idle until a timeout.
-
-nxcomp-3.0.0-34
-
-- Calculate the current congestion as the average of the last 3
- frames sent.
-
-nxcomp-3.0.0-33
-
-- When sending a X_RenderCompositeGlyph update, send a single bit
- if the source X and Y match the values in cache.
-
-- Save the check on the bytes readable from the proxy descriptor
- after the select.
-
-nxcomp-3.0.0-32
-
-- Send the X_GetImage replies uncompressed to better leverage the
- stream compression.
-
-- Before entering in congestion state, force a read to see whether
- the remote proxy aborted the connection.
-
-nxcomp-3.0.0-31
-
-- Try to avoid using memcpy() in the channels' handleFastWrite*().
-
-- Changed the copyright notices at the beginning of the files that
- were referring to NXPROXY to refer to NXCOMP.
-
-nxcomp-3.0.0-30
-
-- Set the agent and proxy descriptors as ready, when appropriate,
- also in the case of an interrupt.
-
-nxcomp-3.0.0-29
-
-- On the X server side, read more events from the X server just be-
- fore and just after having written some data. On the X client si-
- de, apply the same to the proxy link.
-
-- X11 channels originate a congestion control code as soon as the-
- re is some data left from the previous write.
-
-nxcomp-3.0.0-28
-
-- Displaced automatically the "channel unresponsive" and "no data
- received from remote" dialogs if the error condition is ceased.
-
-- Rewritten the channel drain procedure.
-
-- Tried a different approach to the channel congestion handling.
- The X11 channels are not drained after a blocking write but only
- if a further write is requested and the channel is still in con-
- gestion state. Benchmarks show that this is still sub-optimal,
- compared to sending the congestion code immediately also for X11
- channels. See the next version.
-
-nxcomp-3.0.0-27
-
-- Ignored the agent option 'defer'.
-
-- Dropped support for the 1.4.0 versions.
-
-- More fixes to support the 1.5.0.
-
-nxcomp-3.0.0-26
-
-- The channel read buffer can inherit the data to be encoded from
- the caller, instead of taking it from the transport. This is le-
- veraged by the agent channel to save the copy.
-
-- Ignored the agent option 'clients'.
-
-- Removed the deprecated code checking the CPU limits.
-
-- Removed the counters that were duplicated in the Statistics and
- the Control classes.
-
-nxcomp-3.0.0-25
-
-- Improved the effectiveness of the caching of the RenderComposite-
- Glyphs by using a differential encoding for the length, delta x
- and delta y of the first string.
-
-- Better handle the compatibility between different formats of the
- cache files.
-
-nxcomp-3.0.0-24
-
-- Fixed the compatibility problem with the 1.5.0 versions.
-
-- Removed the constants NXDisplayReadable, NXDisplayFlushable and
- NXDisplayCongestion. Now nxcompext has three distinct functions.
-
-nxcomp-3.0.0-23
-
-- Removed support for Rdp, Tight and Hextile packed images decod-
- ing since they have been made obsolete by the new NX server.
-
-- Use the value 0 for the action is_hit and 1 for is_added. This
- increases the frequency of zeroes in the encode buffer, giving
- better compression.
-
-- Changed the copyright attribution from Medialogic to NoMachine.
-
-nxcomp-3.0.0-22
-
-- Implemented an alternate encoding reducing the size of the int
- caches to 16 elements and transmitting the values in blocks of
- 4 bits. Although this encoding reduces the effectiveness of
- the differential compression, it allows better compression of
- the final stream, resulting in a 10% to 20% gain in all condi-
- tions. The new encoding is experimental, as it would make the
- 3.0.0 incompatible with all the previous NX versions. Use this
- package as a reference for future implementations.
-
-nxcomp-3.0.0-21
-
-- Encode the first two coordinates of a FillPoly message by using
- a differential encoding, thus the origin of the polygon is not
- included in the checksum. This is aimed to work in combination
- with the agent converting all the FillPoly requests to the rela-
- tive coordinate mode.
-
-- Add the coordinate mode to the checksum of the PolyPoint and Po-
- lyLine messages so that it doesn't need to be encoded separately.
-
-- Disable the streaming for all messages. This saves the encoding
- of a boolean for each message that could potentially be streamed.
-
-- Don't try to match the block size when encoding a value based on
- an IntCache. This saves the additional bool in 90% of the cases.
-
-- Removed support for the former RDP and RFB session types.
-
-- Due to the above changes, this version is incompatible with the
- previous 3.0.0 releases.
-
-nxcomp-3.0.0-20
-
-- Added support for the 'lossy', 'lossless' and 'adaptive' pack me-
- thod literals. These values activate the dynamic selection of the
- pack method by the agent.
-
-- Made the 'adaptive' pack method the default for all link types.
-
-- The default stream compression level is now 6 for link type ISDN,
- 4 for ADSL and 1 for WAN. The default data compression level is
- always 1, except for LAN that is 0.
-
-nxcomp-3.0.0-19
-
-- Print in the session log the X11 display that the proxy is imper-
- sonating or where it is forwarding the connections.
-
-nxcomp-3.0.0-18
-
-- Implemented decoding of the PACK_BITMAP_16M_COLORS pack method.
- This is a very simple encoder removing the 4th byte in 32 bits-
- per-plane images. This encoder is intended to better leverage
- the stream compression on low bandwidth links.
-
-- Removed the code cleaning the padding bytes in RenderAddGlyphs
- and RenderCompositeGlyphs as the operation is now performed in
- Xrender.
-
-- Removed the "Info: Synchronizing local and remote caches." and
- "Info: Using remote server '...'." lines from the session log.
-
-nxcomp-3.0.0-17
-
-- Determine the CPU endianess at compile time only on Linux and
- Cygwin.
-
-nxcomp-3.0.0-16
-
-- Optimized the memory allocation of the ReadBuffer classes. The
- buffers from the Transport classes are used, when possible, to
- avoid the copy.
-
-nxcomp-3.0.0-15
-
-- Reworked the code dealing with the channel congestion control
- messages for increased efficiency.
-
-- Removed the pending_ flag from the proxy and channel class mem-
- bers. If needed, the classes will query the transport buffers
- to see whether there is data pending.
-
-- Removed the additional parameter from NXTransFlush().
-
-- The proxy doesn't issue anymore a sync control message on a X
- reply. Anyway it will respond to the request for compatibility
- with older versions.
-
-- Removed the dynamic selection of the encoding method for the
- X_QueryColors request and X_ListFonts, X_QueryColors, X_Query-
- Font replies. Now all of them use the differential encoding to
- better leverage the stream compression.
-
-- Fixed to build on SUNs where we don't have endian.h.
-
-nxcomp-3.0.0-14
-
-- When handling partial proxy messages, don't try to determine how
- many bytes still need to be read if the ZLIB stream compression
- is enabled.
-
-- If a message can't be located, the ReadBuffer class checks if it
- is possible to consume the data already in the transport buffer.
-
-- Optimize the MD5 routines by determining the CPU endianess at
- compile time.
-
-- Force Drawable and GContext to be CARD32 in NXproto.h.
-
-nxcomp-3.0.0-13
-
-- Changed the semantic of the NXDisplayFlushHandler callback. The
- function is called when new data is sent to the remote proxy or,
- with a 0 length, upon receiving a new token reply, so that the
- agent can update its congestion state.
-
-- Added the NXTransCongestion() function. It returns a value bet-
- ween 0 and 9 indicating the congestion level based on the tokens
- remaining. A value of 9 means that the link is congested and no
- further data can be sent.
-
-- Removed the congestion and synchronization callbacks. They are
- superseded by the new NXTransCongestion() implementation.
-
-nxcomp-3.0.0-12
-
-- Send the token replies at the end of the encode loop instead of
- flushing the buffer immediately.
-
-- Fixed TR05E01687. Correctly detect CTRL-ALT-SHIFT-ESC keystrokes.
-
-- Renamed the option 'block' as 'tile'.
-
-- Ignored the option 'menu', targeting the X11 agent.
-
-nxcomp-3.0.0-11
-
-- Removed the 'interactive' attribute from generic channels. We now
- use the 'prioritized' attribute which yields the same result.
-
-- Simplified the channels' read loop by always reading only once.
-
-- The channels flush the link as soon as the token is exceeded even
- if the flush policy is set to deferred.
-
-- Reserved more cache memory for the images when running a shadow
- session.
-
-nxcomp-3.0.0-10
-
-- Added the NXDisplayWriteHandler callback definition.
-
-- Removed the code that forced the proxy to retain in the cache the
- images referenced at session startup.
-
-- Disabled the persistent image cache since this is not supported
- by the current agent. This will save the overhead caused by the
- image house-keeping process.
-
-nxcomp-3.0.0-9
-
-- Fixed a cast problem in GetBytesReadable().
-
-nxcomp-3.0.0-8
-
-- Added the NXTransTime() utility. It return the time in milliseconds
- elapsed since the last call to the same function. Useful for bench-
- marking the Xlib layer.
-
-- Ignored the option 'block' targeting the X11 agent.
-
-nxcomp-3.0.0-7
-
-- Ignored the options 'shadow', 'shadowmode' targeting the X11 agent.
-
-- Added the session type 'shadow'.
-
-nxcomp-3.0.0-6
-
-- Fixed TR08D01484. Fixed a bug in the cleanup of the RenderAddGlyphs
- messages. We clean up only the glyphs with depth 8, width greater
- than 1 and pixmap byte pad 4.
-
-- Added file COPYING.
-
-nxcomp-3.0.0-5
-
-- Updated the copyright notices to the current year.
-
-nxcomp-3.0.0-4
-
-- Imported changes up to nxcomp-2.1.0-6.
-
-- Fixed TR12D01563. Changed the configure script to always build the
- library with the -fPIC option. This is related to the way SELinux
- works.
-
-- Fixed the dependency from local endianess for 16-bit color RDP un-
- packing functions. This caused wrong colors to be displayed when the
- proxy and the X server were running on two separate machines having
- different endianess.
-
-- Fixed TR10D01523. The Channel::handleDrain() method now accounts
- for the fact that agent connections can't be drained.
-
-- Changed the Tight and Hextile decoding functions to use the X ser-
- ver's byte order.
-
-nxcomp-3.0.0-3
-
-- Changed the main loop to handle the 3.0.0 version.
-
-nxcomp-3.0.0-2
-
-- Updated the file VERSION.
-
-nxcomp-3.0.0-1
-
-- Opened the 3.0.0 branch based on nxcomp-2.0.0-81.
-
-nxcomp-2.0.0-81
-
-- Fixed the dependency from local endianess for JPEG and PNG decomp-
- ression functions. This caused wrong colors to be displayed when
- the proxy and the X server were running on two separate machines
- having different endianess.
-
-- Fixed the number of entries in the handleColormap() function.
-
-nxcomp-2.0.0-80
-
-- Fixed TR06D01404. Removed the warning issued when calling the
- AgentTransport::drain() method.
-
-nxcomp-2.0.0-79
-
-- Updated copyright to year 2006.
-
-nxcomp-2.0.0-78
-
-- Fixed a bug in the cleanup of the RenderAddGlyphs messages.
-
-- Minor improvements to the encoding of the RenderCompositeGlyphs
- and RenderComposite requests.
-
-- Added 'client' to the list of the ignored options.
-
-nxcomp-2.0.0-77
-
-- Added cleanup of the padding bytes in the RenderCompositeGlyphs
- and RenderAddGlyphs requests.
-
-nxcomp-2.0.0-76
-
-- Before adding the frame's bytes to the tokens, the frame length
- is normalized based on the stream compression ratio of the last
- frame sent. This avoids entering the drain loop too early when
- the data is highly compressible.
-
-- Moved the render messages' private data in a union to reduce the
- footprint of the render store.
-
-nxcomp-2.0.0-75
-
-- The action performed on the remote message store and the affected
- position are encoded as a single value. This saves approximately
- 1 bit per each message.
-
-- Created more Compat classes to handle the backward compatibility
- with the 1.4.0 and 1.5.0 versions.
-
-nxcomp-2.0.0-74
-
-- Added support for the RLE pack method and made it the default if
- the selected link type is LAN.
-
-- Removed the legacy support for the 'render' option provided at X
- server side.
-
-- When defining LAME in ClientChannel.h, the channel has the chance
- of suppressing more opcodes by the handleTaintLameRequest() call.
- This is for test purposes.
-
-nxcomp-2.0.0-73
-
-- The X_NXSetUnpackColormap and X_NXSetUnpackAlpha now carry their
- data in compressed form. The alpha data is compressed using the
- ZLIB RLE encoding, while the colormap data is compressed using
- the default ZLIB deflate.
-
-- Thanks to the above changes, ZLIB data compression of all messa-
- ges which do not have a specific encoding is turned off, so that
- we can make better use of the final stream compression.
-
-- Created new message structures to handle the compatibility with
- the old proxy versions. When connected to an old proxy version
- the agent should use the NXSetUnpackColormapCompat() and NXSet-
- UnpackAlpha() interfaces.
-
-nxcomp-2.0.0-72
-
-- Solved a compatibility problem with the 1.X.X versions due to the
- new render encodings.
-
-nxcomp-2.0.0-71
-
-- Improvements to X_RenderSetPictureClipRectangles.
-
-- Fixed handleUnpack() to pass the correct byte order parameter to
- to the unpack alpha function.
-
-- Added the --parent parameter to the client even in pulldown mode.
-
-- Fixed a deallocation bug in StaticCompressor.
-
-nxcomp-2.0.0-70
-
-- Added compression of X_RenderSetPictureFilter, X_RenderSetPicture-
- Transform, X_RenderTrapezoids and X_RenderTriangles.
-
-nxcomp-2.0.0-69
-
-- Changed the format of the persistent cache to accomodate the new
- encoding of the render opcodes. Caches from the 1.4.0 and 1.5.0
- should be still loaded and saved correctly when connected to and
- old version of the library.
-
-- Improved the encoding of the X_CreatePixmap, X_ChangeGC, X_Render-
- CompositeGlyphs, X_RenderComposite, X_RenderCreateGlyphSet, X_Rend-
- erFreePicture and X_RenderCreatePicture messages. Added new classes
- to handle the backward compatibility.
-
-- Made the static compression and decompression code reside in the
- same class.
-
-nxcomp-2.0.0-68
-
-- Improved the encoding of the X_RenderCreateGlyphSet and X_Render-
- FreeGlyphSet requests.
-
-nxcomp-2.0.0-67
-
-- Modified the following session messages:
-
- From: "Session: Session starting at..."
- To: "Session: Starting session at..."
-
- From: "Session: Session terminating at..."
- To: "Session: Terminating session at..."
-
-- Improved the encoding of the requests creating or freeing an XID.
- This affects X_CreateGC, X_CreateWindow, X_CreatePixmap, X_Render-
- CreatePicture, X_FreeGC, X_DestroyWindow, X_FreePixmap, X_Render-
- FreePicture.
-
-- Added 'streaming' and 'backingstore' to the list of options used
- by agents.
-
-- Modified the info messages to print the ZLIB compression paramet-
- ers to be more compact and only use two lines.
-
-nxcomp-2.0.0-66
-
-- When part of an agent, the proxy will wait for the NXTransDestroy()
- function to initiate the shutdown.
-
-nxcomp-2.0.0-65
-
-- Starting from this version the NX client can control the behaviour
- of the client proxy by monitoring the messages marked as "Session".
-
- At the early initialization the proxy will print:
-
- "Session: Session starting at '...'.
-
- The ellipsis here represent the current timestamp, as reported by
- the POSIX function ctime():
-
- Once the session is running, the proxy will print:
-
- "Session: Session started at '...'.
-
- At the time the session is being shut down, the proxy will print:
-
- "Session: Session terminating at '...'.
-
- Followed by:
-
- Session: Session terminated at '...'.
-
- The message "Info: Starting X protocol compression." is removed,
- replaced by the message 'Session started at...' with the same
- meaning.
-
- Once the message 'Session: Session terminated at..." is read from
- the output, the client can optionally wait for the proxy process
- to complete and terminate with an exit code 0.
-
-- The "Session" messages are not printed when the proxy is running
- on the NX server side, as part of an agent.
-
-nxcomp-2.0.0-64
-
-- Reduced the default token limit from 32 to 24. The synchronizat-
- ion callback is triggered by the tokens going below half the li-
- mit.
-
-nxcomp-2.0.0-63
-
-- Added -I/usr/include/c++ to makedepend.
-
-nxcomp-2.0.0-62
-
-- The house-keeping process is now started upon the initialization,
- if the memory cache is enabled, and, on the X server side, when
- the remote actually requested access to the image cache.
-
-nxcomp-2.0.0-61
-
-- Added a NX_HANDLER_SYNCHRONIZATION callback to NXTransHandler().
- The handler is called when the agent can use the available band-
- width to synchronize X objects that are corrupted or incomplete.
-
- The reason can be:
-
- NX_SYNCHRONIZATION_BEGIN: The synchronizationis is allowed.
-
- NX_SYNCHRONIZATION_END: The synchronizationis must stop.
-
- The reason can be determined by agents by using the NXBeginSynch-
- ronization and NXEndSynchronization values defined in NXvars.h.
-
-- Bytes from 14 to 24 in the X_NXGetControlParameters reply report,
- respectively, the frame timeout, the ping timeout, the preferred
- image split mode and the split size threshold.
-
-nxcomp-2.0.0-60
-
-- The following messages used by the NX client and server have been
- changed. The NX client and server should be modified accordingly.
-
- From: "Info: Shutting down the link and exiting."
- To: "Info: Shutting down the NX transport."
-
- From: "Info: End of session requested by remote proxy."
- To: "Info: End of NX transport requested by remote"
-
- From: "Info: End of session requested by agent termination."
- To: "Info: End of NX transport requested by agent."
-
- From: "Info: End of session requested by signal '...'."
- To: "Info: End of NX transport requested by signal '...'."
-
- From: "Info: Shutting down the link and exiting."
- To: "Info: Shutting down the NX transport."
-
- From: "Info: Waiting for cleanup timeout to complete."
- To: "Info: Waiting the cleanup timeout to complete."
-
- From: "Info: Waiting for watchdog process to complete."
- To: "Info: Waiting the watchdog process to complete."
-
-nxcomp-2.0.0-59
-
-- Added more debug information regarding the timing of packets sent
- and received.
-
-- Added the possibility to redirect the log output to a file that can
- be later shared with nxssh running in "binder" mode. This is useful
- when testing the forwarding of the SSHD connection by nxssh to the
- agent. Activated by defining BINDER in Loop.cpp.
-
-nxcomp-2.0.0-58
-
-- Fixed the unpack alpha procedure to only rely on the image's byte
- order.
-
-- Solved the X_PutImage encoding problem introduced in the 2.0.0-56
- version and restored the compatibility with the 1.5.0 version.
-
-nxcomp-2.0.0-57
-
-- Added a NXTransFile() function. It returns the name of the files
- used by the proxy for the current session.
-
- The type parameter can be:
-
- NX_FILE_SESSION: Usually the file 'session' in the user's session
- directory.
-
- NX_FILE_ERRORS: The file used for the diagnostic output. Usually
- the file 'errors' in the session directory.
-
- NX_FILE_OPTIONS: The file containing the NX options, if any.
-
- NX_FILE_STATS: The file used for the statistics output.
-
- The returned string is allocated in static memory. The caller must
- copy the string upon returning from the function, without freeing
- the pointer.
-
-- Fixed the PANIC in the handling of the abort split messages.
-
-- The encode and decode routines may write one byte past the nominal
- end of the encode buffer. This additional byte is now included in
- the payload. This is actually a bug, but harmless.
-
-nxcomp-2.0.0-56
-
-- Added the X_NXAbortSplit request. It can be used to interrupt the
- streaming of all the messages currently in the split store for
- the specified resource. Depending if the split store did or did
- not contain split messages, the client will receive an immediate
- end-split or no-split notification.
-
-- Removed the split modes NXSplitModeEager and NXSplitModeLazy. The
- available modes are now NXSplitModeSync and NXSplitModeAsync. The
- mode NXSplitModeAsync replaces the two old modes and is now the
- default. Similarly to NXSplitModeEager, it makes the proxy split
- only messages that exceed a size threshold, but the threshold is
- generally smaller than in the previous versions.
-
- #define NXSplitModeDefault 0
- #define NXSplitModeAsync 1
- #define NXSplitModeSync 2
-
-- Renamed X_NXSplit to X_NXSplitData, X_NXAbortSplit to X_NXSplitEv-
- ent.
-
-- The proxy now enters a drain loop, when in congestion state, and
- waits until the decongestion. Also the X channels are drained if
- blocked.
-
-- The select is restarted immediately if only the proxy is selected
- and the data read doesn't make a complete message.
-
-- The size of the shared memory segment used by the X server proxy
- is now negotiated at startup and the selected value is printed in
- the session log.
-
-- Added the option 'encrypted'. It tells the local proxy if it is
- running as part of a program providing encryption of the point to
- point communication. This is useful to determine if the proxy can
- block waiting for data or needs to yield to the client to let it
- handle the remote connection.
-
-nxcomp-2.0.0-55
-
-- Fixed handleRestart() to correctly send the end-split event only
- after the split sequence has been closed by the client.
-
-- Fixed a possible memory error in the Keeper class occurring if the
- image caches were erased while in the middle of a loop.
-
-nxcomp-2.0.0-54
-
-- Added a '--parent' option when running the client in dialog mode.
- This is the process id that needs to be signaled in the case the
- user chooses to do so.
-
-nxcomp-2.0.0-53
-
-- Solved a bug in the abort split procedure. The procedure assumed
- that the split had to be at the head of the list. This may not be
- the case if the split was loaded from disk asynchronously, after
- a different split with the same checksum was recomposed.
-
-- By defining STRICT in Loop.cpp, the number of available tokens is
- set to 1. This can be used to trigger the congestion more often
- than it would possible when testing the software with the default
- settings.
-
-- Added more debug output to the procedures handling the streaming
- of the images.
-
-- Reset the channel's split pending and congestion flags in the fin-
- ish procedure. Not doing so caused some additional loops at chan-
- nel shutdown.
-
-- Fixed a bug on Cygwin that prevented the log files to be succes-
- sfully reopened when the size limit was exceeded.
-
-- Failures to write to the agent transport are reported sooner when
- the channel is finished. This saves a few more loops at session
- shutdown.
-
-nxcomp-2.0.0-52
-
-- Started implementing a new handler to let the agent include arbit-
- rary data in the transport statistics. The parameter, in this case,
- is a pointer to a pointer to a null terminated string. The pointer
- is set at the time the handler is registered. The pointed string
- will have to be filled by the agent with its statistics data. For
- now, only the interfaces and the stubs exist.
-
-- Disabled the timestamp cache as it still causes rounding problems
- when calculating the current bitrate.
-
-nxcomp-2.0.0-51
-
-- Removed SelectPackMethod(), not used anymore, from Pack.c.
-
-nxcomp-2.0.0-50
-
-- Added the X_NXFinishSplit request. It forces the proxy to comple-
- tely transfer all the split messages for the given resource, and
- then notify the agent.
-
-- Fixed the statistics to not account the split bits to the control
- token.
-
-nxcomp-2.0.0-49
-
-- Fixed a bug that caused the split timeout to be reset even if a
- different channel had splits to send.
-
-- Removed an error condition that arose when a split operation was
- requested by a different channel than the first to connect. The
- reason is that an auxiliary channel (like the one created by the
- server to store the keyboard configuration) can be the first to
- open a connection to the X server, then can come the agent, that
- is actually using the NX opcodes. The proxy will now simply print
- a debug message.
-
-- Removed a further error condition that was assumed by the proxy
- if a pending flush was detected while no channel was selected for
- output. This can actually happen if the channel was dropped and,
- in the meanwhile, the user requested the proxy statistics.
-
-nxcomp-2.0.0-48
-
-- Added a 'type' parameter to NXTransFlush(). The new NX_FLUSH_IDLE
- type should be used by agents when they have finished handling all
- their clients and are going to wait for more input. This is the
- case, for example, of the X agent returning from WaitForSomething()
- after having set a small timeout to find out if there are clients
- ready, or the case of a RDP agent finding that there are no opcodes
- to read from the RDP server. The 'idle' flush should be requested
- also when the X11 agent is waiting for a split to complete. When
- the flag is used, the proxy uses the available bandwidth to encode
- more low-priority data, like the payload of images being streamed.
-
-nxcomp-2.0.0-47
-
-- Added a new RGB image encoder. For now the encoder uses a static
- Z stream to compress the image data in the destination buffer and
- allows the agent to use the simplest encoding by still separating
- the alpha channel from the image data. The new encoder can be the
- the base for implementing color reduction by dithering or a color-
- mapped translation of the image similar to PNG, but without the
- PNG overhead and with the colormap being sent to the client using
- the NXSetUnpackColormap() opcode.
-
-- Put the routines implementing static deflating and inflating of
- a ZLIB buffer from the Compressor and Decompressor classes to Z.h
- and Z.cpp, so that they can be reused by the new RGB encoder.
-
-nxcomp-2.0.0-46
-
-- Fixed a segfault arising when trying to start a child without the
- NX transport.
-
-nxcomp-2.0.0-45
-
-- Undefined the MATCH directive.
-
-nxcomp-2.0.0-44
-
-- Changed the encoding of the X_CreatePixmap, X_CreateGC, X_Render-
- CreatePicture, X_CreateWindow, RenderCreateGlyphSet.cpp. The Xid
- of the drawable is included in the checksum of the X_CreateGC and
- X_CreatePixmap message. This leverages the way GC and Pixmaps are
- allocated in the X agent to obtain better compression.
-
-- Removed the code handling the reset of the proxy connection. This
- functionality was unused since when the persistence is handled by
- the agent.
-
-- Added a specific section in the statistics output for the render
- extension.
-
-nxcomp-2.0.0-43
-
-- Fixed a bug that could have caused the sending of multiple 'end
- split' messages for the same split sequence.
-
-- Added handling of the option 'strict'.
-
-nxcomp-2.0.0-42
-
-- Added a missing channel switch directive when encoding abort split
- messages at the server side. This could cause a decoding error on
- the client.
-
-nxcomp-2.0.0-41
-
-- Ensured that the link is flushed immediately on the X server side
- when important keyboard or mouse activity is detected in input.
-
-- Implemented a timestamp cache to avoid calling gettimeofday() when
- it is enough to use the last timestamp gotten from the system. The
- cache can be disabled by undefining CACHE_TIMESTAMP in Timestamp.h.
-
-nxcomp-2.0.0-40
-
-- Added the karma delay field to the X_NXGetControlParameters reply.
-
-- Solved a bug with the decoding of split messages likely to happen
- only when using link type LAN.
-
-nxcomp-2.0.0-39
-
-- Implemented separate flow control for the generic channels and the
- image streaming data.
-
-- Improved the split procedure to load a message from the disk cache
- if found after it was originally discarded because locked.
-
-nxcomp-2.0.0-38
-
-- Renamed the 'shmem' option as 'shseg'. The 'shmem' option becomes
- specific to the agent and will be used together with 'shpix' option
- to indicate if, respectively, the shared memory extension and the
- use of the shared pixmaps must be enabled in the agent server. The
- new option will be instead used by the proxy to determine the size
- of the memory segment shared between the proxy and the X server.
-
-- Added the 'shmem', 'shpix', 'keyboard' and 'clipboard' to the list
- of ignored options. The 'keyboard' option should become a synonym
- of 'kbtype'. The 'clipboard' option will tell the NX agent if the
- clipboard support should be disabled for security reasons.
-
-nxcomp-2.0.0-37
-
-- Ensured that, when running a raw session, the persistent cache is
- loaded and saved only once in the session lifetime.
-
-- Added the 'product' keyword to the list of recognized options. The
- option is ignored by the proxy, but can be used by the client or
- server to facilitate the support.
-
-nxcomp-2.0.0-36
-
-- Added the remote version number in the X_NXGetControlParameters
- reply.
-
-- Solved a bug related to the removal of the split stores.
-
-- Removed the unused code dealing with the flush timeouts.
-
-nxcomp-2.0.0-35
-
-- Added an alert to notify the user about the failure of the XDMCP
- session.
-
-nxcomp-2.0.0-34
-
-- The active channels and the agent resources are now stored in a
- list container.
-
-- Added the X_NXFreeSplit request. The request is currently unused
- because the split store is freed automatically when it becomes
- empty, but can be useful in future if we want to implement other
- otpimizations.
-
-nxcomp-2.0.0-33
-
-- There is now a split store for each agent resource. This allows
- the proxy to divide the bandwidth among the agent resources.
-
-- A simple round-robin load-balancing is implemented, dividing the
- bandwidth equally among all the split stores.
-
-- If there is a previous request being streamed for the same res-
- ource, cached messages are appended to the split store and then
- committed in the original order. This makes possible to stream
- the colormap and the alpha channel data even if the split invol-
- ves multiple PutImage or PutPackedImage operations in a single
- start-split/end-split sequence.
-
-- Implemented the commit store class. Made the commit store expand
- the message in the final buffer, instead of leveraging the mes-
- sage store.
-
-- Channels having a drop command pending are checked before trying
- to load or save the cache. This prevents a potential problem with
- the protocol violation error that could be reported by the client
- side proxy.
-
-- The current bitrate is now calculated at the time the transport
- actually writes the data to the network, not at the time the data
- is appended to the transport by the upper layers. The reason is
- that the data can be compressed by the stream compressor and so
- we can calculate the real bitrate only after having flushed the
- ZLIB stream. This fixes the wrong numbers that could be reported
- by the statistics in the previous versions.
-
-nxcomp-2.0.0-32
-
-- More progress in the implementation of the new image streaming.
- This version has been tested to work when connecting to an 1.5.0
- server. Due to the significant changes in the way the streaming
- works in the newer versions, split is never activated by a 2.0.0
- server connecting to a 1.5.0 client.
-
-- Fixed the NXTransClose() function to check if the fd matches the
- NX agent connection.
-
-- Fixed the includes in Socket.h to compile on Solaris and MacOSX.
-
-nxcomp-2.0.0-31
-
-- Changed the NX transport functions that didn't require a NX fd
- parameter to include one. The value can be NX_FD_ANY to signify
- any running NX transport.
-
-nxcomp-2.0.0-30
-
-- More progress in the new implementation of image streaming.
-
-- This version is apparently compatible with the 1.5.0 client but
- needs further testing.
-
-nxcomp-2.0.0-29
-
-- Implemented the NXTransHandler() interface and made the proxy
- use the callback, when it is installed, instead of the notifi-
- cation events.
-
-- Modified the agent transport to report an EOF condition as soon
- as the channel is dropped, instead of reporting the error only
- after the proxy shutdown. This allows the agent to handle its
- clients while the proxy is handling the grace timeout.
-
-- Added a test facility to verify if the client and server caches
- match at shutdown.
-
-- More advances in the new implementation of streaming.
-
-nxcomp-2.0.0-28
-
-- Made the session shutdown faster, normally below 1 second. The
- grace time is now 500 ms once all channels have been dropped.
-
-nxcomp-2.0.0-27
-
-- The house-keeping process will now run a number of iterations
- (currently 100) and then will exit. The proxy will check the
- exit code and, if it was requested by the child, will restart
- it. This is intended to keep the memory consumption low, as I
- noted that after a big number of iterations the performance of
- the allocator start to degrade quickly.
-
-nxcomp-2.0.0-26
-
-- Started implementing the NXTransHandler() interface to let the X
- application hook a callback and be notified by the proxy when an
- event occurs. At the moment only congestion events are supported.
- The interface makes possible for the caller to provide a generic
- parameter. This parameter is passed back to the handler function.
- The parameter is expected to be the Xlib display pointer, given
- that the proxy doesn't have access to the Xlib structures.
-
-- Moved all the internal variables shared between Xlib, nxcompext
- and the X server in nxcomp. Declarations and function prototypes
- moved to NXvars.h.
-
-- Removed the NXGetCleanupParameters() and NXGetImageParameters()
- interfaces and the remaining references to the unused display
- buffer and image cleanup functions.
-
-- In this version the images streaming functionality is disabled.
- Because of that, expect compatibility problems when connecting
- to a different nxcomp version.
-
-nxcomp-2.0.0-25
-
-- Forced the end of the session earlier if a shutdown has been re-
- quested by the local side but the remote proxy is not responding.
-
-nxcomp-2.0.0-24
-
-- Changed the loop deleting the file items in Keeper to pick the
- first element instead of looping through the iterator.
-
-- More problems with the libstdc++ allocators. During the tests, I
- found that the Keeper class can leak industrial amounts of memory.
- Valgrind says that the objects that are not freed are the File
- items we allocate in collect(). As this looked suspicious, I log-
- ged the constructors and destructors and can say that everything
- is OK on our side. Unfortunately, by removing the spleeps used
- to let the program work silently in background, one can find that
- the memory occupation still grows by a MB every few seconds. This
- is less a problem on Windows, where the memory occupation remains
- almost constant. See the comment on __USE_MALLOC below.
-
-- Increased the maximum size of a message that the proxy is allo-
- wed to cache to 4MB. This makes possible to cache many replies
- (like the X_QueryFont replies) that often exceeded the previous
- limit.
-
-nxcomp-2.0.0-23
-
-- Fixed a compatibility problem with the 1.5.0 that arose when
- encoding an image with caching and streaming temporarily disa-
- bled.
-
-- Removed the __USE_MALLOC define in Types.h because this is what
- the g++ developers want. I'll try to avoid flames and will not
- comment on this.
-
-- Added a --with-use-malloc configure option. This option should
- be used when building the release packages on GCC versions that
- support it.
-
-- Started fixing the commit procedure to be able to deal with the
- alpha channel.
-
-nxcomp-2.0.0-22
-
-- Prevented channels from being dropped while in the middle of a
- read loop.
-
-- Added a small utility ensuring that the SIGCHLD we receive in
- the main loop can be always identified as pertaining to an our
- child.
-
-- Increased the space available for the control messages at the
- beginning of the encode buffer and ensured that there is always
- enough space for adding a token message, in the case this is
- required by the flush procedure.
-
-- Made all cache files readable only by the user.
-
-nxcomp-2.0.0-21
-
-- Solved a bug in the streaming of images that caused the agent's
- clients to never resume when connected to an old proxy version.
-
-nxcomp-2.0.0-20
-
-- Disabled again streaming of the alpha channel data. By enabling
- it, the agent randomly fails to repaint the exposed regions. The
- reason is to be investigated.
-
-nxcomp-2.0.0-19
-
-- Implemented the split mode NXSplitModeSync. When this mode is
- selected, the proxy will not send data for the split at the head
- of the list until the remote peer has confirmed that the message
- is not available in the image cache. This is going to be useful
- in combination with the lazy encoding.
-
-- Improved the error detection in the case of failure when saving
- a recomposed split on disk.
-
-- Added X_NXSetUnpackAlpha to the set of requests that is possible
- to stream.
-
-nxcomp-2.0.0-18
-
-- Enabled the 2.0.0 features that were disabled for test purposes.
-
-- Changed the LICENSE file to state that the software is only made
- available under the version 2 of the GPL.
-
-nxcomp-2.0.0-17
-
-- Introduced a new channel of type 'slave'. Opening a slave channel
- should let the proxy fork a new NX client instance (or whatever
- is in the NX_SLAVE environment) and pass to it the channel's desc-
- riptors. This client instance should authenticate the peer, for
- example using the proxy cookie (see how this is implemented in
- nxsensor) and then negotiate the service to be used on the channel.
- This can be used to implement forwarding of arbitrary ports or ad-
- ditional services, like a simple file transfer protocol. For now
- the implementation is incomplete. Opening a slave channel will
- result in the remote proxy just dropping the channel connection.
-
-- The proxy is forcibly flushed at the end of each loop. This is a
- temporary fix until the agents are updated to flush the proxy link
- on demand.
-
-- Added a new alert to be used in the case the RDP session is closed
- and replaced with a new session using the same Windows account.
-
-- Added a forward declaration of class RenderMinorExtensionStore in
- file RenderExtension.h to compile using gcc 4.0.X.
-
-- Added removal of all .orig file when running a 'make clean'.
-
-- The code uses again the 2.0.0 style shutdown (the one waiting for
- the watchdog process to terminate).
-
-nxcomp-2.0.0-16
-
-- Added the NXTransChannel() interface to allow agents to create
- new channels connected to the port that will be forwarded by the
- remote proxy. The function returns 1 on success, 0 if the NX
- transport is not running, or -1 in the case of error. On success,
- the descriptor provided by the caller can be used for all the
- subsequent I/O, including selecting the descriptor to check if
- I/O is possible. The type parameter not only tells to the proxy
- the remote port where the channel has to be connected, but gives
- a hint about the type of data that will be carried by the channel,
- so that the proxy can optimize the compression and schedule the
- traffic on the slow link.
-
- The type can be:
-
- NX_CHANNEL_X: The channel will carry X traffic and it
- will be connected to the remote X display.
-
- NX_CHANNEL_CUPS: The channel will carry CUPS/IPP protocol.
-
- NX_CHANNEL_SMB: The channel will carry SMB/CIFS protocol.
-
- NX_CHANNEL_MEDIA: The channel will transport audio or other
- multimedia data.
-
- NX_CHANNEL_HTTP: The channel will carry HTTP protocol.
-
- NX_CHANNEL_FONT: The channel will forward a X font server
- connection.
-
- Only the proxy running at the NX server/X client side will be
- able to create a X, CUPS, SMB, MEDIA and HTTP channel. A proxy
- running at the NX client/X server side can create font server
- connections. The channel creation will also fail if the remote
- end was not set up to forward the connection.
-
- To create a new channel the agent will have to set up a socket-
- pair and pass to the proxy one of the socket descriptors.
-
- Example:
-
- #include <sys/types.h>
- #include <sys/socket.h>
-
- int fds[2];
-
- if (socketpair(PF_LOCAL, SOCK_STREAM, 0, fds) < 0)
- {
- ...
- }
- else
- {
- //
- // Use fds[0] locally and let the
- // proxy use fds[1].
- //
-
- if (NXTransChannel(fds[1], NX_CHANNEL_X) <= 0)
- {
- ...
- }
-
- //
- // The agent can now use fds[0] in
- // read(), write() and select()
- // system calls.
- //
-
- ...
- }
-
- Note that all the I/O on the descriptor should be non-blocking,
- to give a chance to the NX transport to run in the background
- and handle the data that will be fed to the agent's side of the
- socketpair. This will happen automatically, as long as the agent
- uses the XSelect() version of the select() function (as it is
- normal whenever performing Xlib I/O). In all the other cases,
- like presumably in the agent's main loop, the agent will have
- to loop through NXTransPrepare(), NXTransSelect() and NXTrans-
- Execute() functions explicitly, adding to the sets the descript-
- ors that are awaited by the agent. Please check the implementa-
- tion of _XSelect() in nx-X11/lib/X11/XlibInt.c for an example.
-
-nxcomp-2.0.0-15
-
-- Some changes aimed at finding a workaround to the unreliability
- of the font server connections. The X server seems to be really
- picky about the network latency, so we try to read immediately
- from the channel just being created, instead of waiting for a
- new loop. Additionally the proxy will keep reading from the font
- server connections even after the maximum length of the frame
- is exceeded, in the hope that it will be able to send a complete
- message in a single frame.
-
-- updated the various internal consistency tests run when the TEST
- or INFO flags are enabled.
-
-nxcomp-2.0.0-14
-
-- It seems that the closure of the socket sometimes takes several
- seconds, on Windows, after the connection is broken, with the
- result that the alert can be shown long after the user has gone
- after the failed session. We now skip the closure of the proxy
- link on Windows if we are about to exit.
-
-- The code uses the 1.5.0 style shutdown (the one waiting for the
- term signal in the main process) to be able to test the library
- with the old server. To activate the new shutdown procedure be
- sure the define SHUTDOWN_COMPATIBLE_1_5_0 is unset.
-
-nxcomp-2.0.0-13
-
-- Ensured that static members in channels are reset at the time a
- new proxy is created.
-
-- Adjusted the token parameters for link modes other than modem.
-
-nxcomp-2.0.0-12
-
-- Handled compatibility with 1.X.X versions not sending the count
- field in the token.
-
-- The proxy link is now flushed automatically if the agent has not
- set the deferred flush mode.
-
-nxcomp-2.0.0-11
-
-- Significant modifications to allow the proxy to keep data in the
- encode buffer across multiple loops, until the data is flushed
- because an explicit request by the agent or. Besides maximizing
- the amount of data sent in a single frame, this makes it possi-
- ble to move any packet coalescence strategy in the agent, while
- still using an 'immediate' flush policy.
-
-- Modified the procedure handling the proxy congestion. Each token
- now carries a counter which represents the multiple of TokenBytes
- data bytes that need to be confirmed by the remote end. The ser-
- ver side proxy will need to reply by including the value of the
- counter. When sending a new token, the tokens are decremented by
- the counter and the client side proxy enters in congestion when
- the available tokens becomes zero or negative.
-
-nxcomp-2.0.0-10
-
-- Implemented specific encoding of the X_NXSetCacheParameters
- request.
-
-- Handled the compatibility with older versions not supporting the
- new request. In this case the request is handled at the local si-
- de, preventing the X requests to be cached or split, even without
- the cooperation of the remote side.
-
-nxcomp-2.0.0-9
-
-- Modified the shutdown procedure to not rely on the TERM signal
- when the proxy needs to wait for the server to complete. We will
- now print the following message in the session log:
-
- Info: Watchdog running with pid 'n'.
- Info: Waiting for watchdog process to complete.
-
- The NX server will have to kill the process with the given pid
- to mandate the proxy shutdown. This solves the TR11C01192.
-
-- Added the X_NXSetCacheParameters request. It tells to the proxy
- how to handle caching of X requests, namely if requests should
- be stored in the memory cache, split in smaller data chunks and,
- in the case of images, saved on disk in the persistent image
- cache. The request affects all the X messages until the proxy
- is further configured.
-
-- Enabling and disabling loading and saving of persistent images
- due to a X_NXSetCacheParameters is still to be implemented.
-
-- Implemented font channel compatibility with older versions. If
- the font port is queried and the remote proxy doesn't support
- the tunneling of font server connections, an empty string is
- returned.
-
-- The option 'resize', used by agents, is now silently ignored.
- This solves the TR10C01061.
-
-- Added the missing reference to TR08C000981.
-
-nxcomp-2.0.0-8
-
-- Discarded the first idea of setting the font path implicitly in
- the X server side proxy, by means of a multi-pass operation and
- added the NXGetFontParameters() request and reply. If the proxy
- has been configured accordingly, the request returns the X font
- path that can be set by the agent to tunnel the font server con-
- nections through the NX link.
-
-- Changed the parsing of the font server port to be able to handle
- the defaults.
-
-nxcomp-2.0.0-7
-
-- More work on tunneling of font server connections.
-
-- The synchronization requests are now replied at the same time
- as a new request is received, by checking if the channel has
- already gone past the awaited sequence number. This avoids the
- delay caused by the previous versions in the case the expected
- reply had been handled asynchronously, inside the write loop.
-
-nxcomp-2.0.0-6
-
-- The display is again passed to the client using the -display
- parameter.
-
-- The option 'type' is now ignored at X server side. Support at
- the X server side had been left for compatibility with older
- versions of the proxy.
-
-- Added direct support for more session types, namely 'unix-cde',
- 'unix-xdm', 'unix-console', 'unix-default'. The 'unix-console'
- and 'unix-default', similarly to 'unix-application', will now
- trigger the 'raw' mode.
-
-nxcomp-2.0.0-5
-
-- Renamed Png.h and Png.cpp to Pgn.h and Pgn.cpp to avoid name
- clashes on Windows.
-
-- The distclean target now removes the autom4te.cache directory.
-
-nxcomp-2.0.0-4
-
-- Added the 'kill=n' option to let the proxy add the process to
- the list of daemons that must be terminated at session shutdown.
- Multiple 'kill=n' options can be specified. The proxy will send
- to each process a SIGTERM signal before exiting.
-
-- Removed the code that forcibly disabled the RENDER extension on
- Solaris. Eventual compatibility problems will be now handled in
- the NX agent.
-
-- The path to the client executable is now assumed to be in the
- NX_CLIENT environment. If the variable is not set, the proxy
- will guess the location based on the target platform. This is
- part of the FR11C01215.
-
-nxcomp-2.0.0-3
-
-- More code cleanup. Protocol step 5 and cache step 2 are assumed
- by default. This allows us to remove the various channel caches
- that are not used anymore.
-
-- Removed the outdated encodeBegin() and encodeEnd() methods.
-
-nxcomp-2.0.0-2
-
-- Added compatibility with the 1.5.0 and 1.4.0 versions. Protocol
- version older than the 1.4.0 will cause the proxy to drop the
- connection.
-
-- Rewritten the version negotiatiation logic to better handle the
- compatibility between the local and the remote version.
-
-- Removed the conditional code handling the compatibility with
- the protocol encodings from 1 to 4.
-
-- Small adjustments to the session negotiation procedure to give
- more hints in the case of errors. A dialog is now issued if the
- remote proxy drops the connection due to a probable authentica-
- tion failure or when the remote proxy version is not compatible
- with our version.
-
-nxcomp-2.0.0-1
-
-- Opened the 2.0.0 branch based on nxcomp-1.5.0-80.
-
-nxcomp-1.5.0-80
-
-- Fixed a bug that prevented the Unix socket to be created in the
- right directory. This affected the ability of the server to run
- NX sessions without the agent encoding.
-
-nxcomp-1.5.0-79
-
-- Solved a bug in the 15 to 16 bpp conversion for RDP sessions.
-
-- Corrected a typo in the PANIC message of Unpack16To24 function.
-
-- Optimized the 16 bpp RDP decompression routine.
-
-nxcomp-1.5.0-78
-
-- Implemented the FR11C01215. The following environment variables
- are checked to determine the location of the relevant NX direct-
- ories:
-
- $NX_ROOT The root NX directory is the place where the session
- directory and the cache files are created. This is
- usually overridden by passing the 'root=' option. By
- default, the root NX directory is assumed to be the
- directory '.nx' in the user's home.
-
- $NX_SYSTEM The directory where NX programs and libraries reside.
- If not set, the value is assumed to be '/usr/NX'.
- Programs, libraries and data files are respectedly
- searched in the 'bin', 'lib' and 'share' subdirecto-
- ries.
-
- $NX_HOME The NX user's home directory. If $NX_ROOT is not set
- or invalid, the user's NX directory is created here.
-
- $NX_TEMP The directory where the X11 Unix Domain Sockets and
- all temporary files are to be created.
-
- $NX_CLIENT The full path to the nxclient executable. If the va-
- riable is not set, the nxclient executable will be
- run assuming that the program is in the system path.
- This can be useful on platforms like Windows and the
- Mac where nxclient is located in a different direct-
- ory compared to the other programs, to make easier
- for the user to execute the program from the shell.
-
- Other environment variables:
-
- $HOME The variable is checked in the case $NX_HOME is not
- set, null or invalid.
-
- $TEMP The variable is checked whenever the $NX_TEMP direct-
- ory is not set, null or invalid.
-
- $PATH The path where all executables are searched, except
- nxclient. If $NX_CLIENT is not set, also the client
- executable is searched in the system path.
-
- $XAUTHORITY
- This is the file containing the X11 authorization
- cookies. If not set, the file is assumed to be in
- the user's home (either $NX_HOME or $HOME).
-
- $LD_LIBRARY_PATH
- System-wide library search order. This should be set
- by the program invoking the proxy.
-
-- Extended the usage message to document the relevant environment.
-
-- Made the WaitChild() function interruptible. This allows the user
- to terminate the connection procedure immediately, by sending a
- signal to the proxy process while an abort dialog is shown in the
- foreground. This is part of the solution to the TR11C01216.
-
-- Implementation of the FR11C01215 is not yet complete. The client
- program and the nxauth/xauth are still searched using the previ-
- ous logic. In particular, the NX_CLIENT variable is ignored.
-
-nxcomp-1.5.0-77
-
-- Corrected the typo in the alert dealing with VNC authentication
- failures. This solves the TR11C01199.
-
-nxcomp-1.5.0-76
-
-- Added the missing initialization in the client and server proxy
- constructors.
-
-nxcomp-1.5.0-75
-
-- Starting from this version the build procedure will automatically
- create a DLL on Windows.
-
-- Disabled exceptions in the compiled code.
-
-- Disabled run-time type information to further reduce the size of
- the executable.
-
-- Compiling with GCC 4.0.0 and -fno-exceptions produces a warning
- in some files, due to control apparently reaching the end of a
- non void function. This is bogus and has been confirmed to be a
- GCC 4.0.0 bug solved in more recent versions.
-
-nxcomp-1.5.0-74
-
-- Imported changes from nxcomp-1.6.0-4.
-
-- Solved a compilation error on Solaris and MacOSX platforms.
-
-- The 'font' option now accepts either a numeric value (for a TCP
- port) or a 'unix/:port' or 'tcp/:port' specification. In the case
- of Unix ports, we assume that a port specification "unix/:7100"
- corresponds to the "/tmp/.font-unix/fs7100" socket and a port like
- "unix/:-1" corresponds to "/tmp/.font-unix/fs-1".
-
-- An absolute file path is also accepted as a valid socket. This is
- useful to test the forwarding of the font server connection, for
- example by running a normal X client and pointing the socket to
- the X server.
-
-- Protocol step 7 is now only assumed when connecting to a remote
- proxy version 1.6.0 or later.
-
-nxcomp-1.5.0-73
-
-- Use the include files from nx-X11 if the nx-X11/include directory
- is found. The previous configure checked the presence of nx-X11/
- exports/include, that might not be built at the time this library
- is compiled.
-
-nxcomp-1.5.0-72
-
-- Fixed a problem on AMD64 due to the size of the area pointed by
- the argument of NXTransReadable(). The ioctl() requires a pointer
- to an int, at least on Linux. The original _X11TransBytesReadable()
- function simply calls the ioctl() by passing the pointer that is
- provided. Returning the value assuming a pointer to a long crashes
- some applications, among them xterm. Now NXTransReadable() follows
- the same schema of the ioctl() call and stores the result assuming
- a pointer to an int.
-
-nxcomp-1.5.0-71
-
-- Ensured that the NX trasport is destroyed on NXTransExit() even if
- the parent has overridden our signal handlers.
-
-- Added attribute 'noreturn' to NXTransExit().
-
-- Small change to the shutdown procedure to send the "Waiting for a
- further signal" just after the watchdog is started.
-
-nxcomp-1.5.0-70
-
-- Added the definition of protocol step 7. The new protocol step is
- implicitly assumed when activating the font server channel, so that
- NX clients and servers may decide what to do by verifying the patch
- version of the peer software. This makes possible to activate the
- feature without stepping up the 1.5.0 version of the software.
-
-nxcomp-1.5.0-69
-
-- Added the -fPIC GCC flag when compiling on AMD64 architectures.
-
-- Small changes to configure.in to have specific CFLAGS.
-
-- Created a new configure using autoconf 2.59.
-
-- Added the 'mask=n' option to determine how channel ids are distri-
- buted between client ans server. By default, channels whose ids are
- multiple of 8 (starting from 0) are reserved for the client side.
- All other channels can be allocated at the NX server side.
-
-- A check is missing on the protocol supported by the remote side,
- so it is likely that mixing this version with older 1.5.0 will not
- work.
-
-- The release has the debug logs enabled.
-
-nxcomp-1.5.0-68
-
-- Added provision for opening new channels on both client and server
- side. This required small changes to the way channel ids are mapped
- and retrieved, so that both sides now support bidirectional mapping
- of file descriptors to channels.
-
-- Made the code handling allocation of new generic channels to reside
- in the base Proxy class.
-
-nxcomp-1.5.0-67
-
-- Renamed the 'embedded keyboard' channels as 'aux' channel.
-
-- Renamed 'samba' channels as 'smb'.
-
-- The 'samba' and 'smb' options can now be used interchangeably. The
- same applies to the 'keybd' and 'aux' options, used to set up the
- auxiliary X channel.
-
-- Added a new font channel. The channel is used to forward X font
- server connections from the X server on the NX client to the remote
- NX server. The channel is not yet functional and requires change to
- the channel allocation mechanism.
-
-- Added a common interface to create new listening sockets. This is
- currently used for additional services, but not for the X display
- sockets.
-
-- Simplified the interface used to accept new connections to channels
- being forwarded.
-
-- Removed the -V option as nxproxy is not using dlopen() anymore.
-
-- Removed the inclusion of ClientChannel.h in Proxy.cpp that caused
- test symbols to be reverted to undefined.
-
-nxcomp-1.5.0-66
-
-- Made failures setting the IPTOS_LOWDELAY on the proxy socket to
- cause a warning, instead of an error.
-
-- Made the clean target delete the Cygwin specific libraries.
-
-- Updated the configure and Message.h to deal with GCC 4. Solves the
- TR08C000981.
-
-nxcomp-1.5.0-65
-
-- Removed the warning issued on parsing the agent option 'rootless'.
- Solves the TR08C00959.
-
-- MacOSX 10.4 defines socklen_t. Made the definition conditional so
- that we can still support older versions. Solves the TR07C00926.
-
-- Updated the ChangeLog to include references to the solved TRs.
-
-nxcomp-1.5.0-64
-
-- Imported the 1.6.0 changes in the maintenance 1.5.0.
-
-- Removed a wrong assertion that might cause the session to fail
- when the software was compiled with TEST enabled in Proxy.cpp.
-
-- The nxclient dialog process is signaled with SIGKILL on Windows,
- as the SIGTERM is ignored. This solves the TR07C00929.
-
-- Ensured the JPEG error flag is always set before jumping out of
- the Jpeg decompression.
-
-- Skipped errors encontered setting the TCP_NODELAY flag on Mac.
- Solves TR08C00940.
-
-- Few cosmetic changes.
-
-nxcomp-1.5.0-63
-
-- Ensured that the parent is checked often in the keeper process,
- so that, in the case of a premature death, the child is exited
- earlier.
-
-nxcomp-1.5.0-62
-
-- Some performance tuning of the LAN and WAN link modes.
-
-nxcomp-1.5.0-61
-
-- Fixed the problems arisen with loading or saving the image files
- on Windows by forcing the streams to be opened in binary mode.
- These problems have been triggered by the recent Cygwin upgrade.
-
-- Removed the logs that had be left enabled for test purposes.
-
-nxcomp-1.5.0-60
-
-- Made all errors encountered while unpacking an image just print
- a warning in the session log. Such errors are not fatal but the
- client monitors the state of the session at startup, so that by
- marking image decompression errors as such may cause the session
- to be aborted.
-
-- Marked as warnings also errors encountered by trying to load an
- image from disk.
-
-nxcomp-1.5.0-59
-
-- When detected, the CTRL+ALT+SHIFT+ESC sequence is removed from
- the event stream.
-
-- Also modified the message in the session log to issue a warning,
- instead of an error.
-
-nxcomp-1.5.0-58
-
-- Added a setjmp() before yielding the control to the JPEG library.
- This makes possible to recover from the JPEG decompression errors
- that were previously fatal.
-
-- In the commit split request, the client id is now encoded by the
- client channel beside the propagate flag. The client id is igno-
- red by the decoding party. As in the old protocol versions, the
- committing client is taken from the client id that was originally
- sent together with the packed image.
-
-- Fixed the compilation problem when defining OPCODES in Misc.cpp.
-
-- Skipped the synchronous flush of the proxy link when connecting
- to a previous NX version.
-
-- Ensured that the new alerts are only requested when connected to
- a compatible proxy.
-
-- Ignored the option 'fullscreen', targeting the agents.
-
-nxcomp-1.5.0-57
-
-- Added more alerts and changed the name of those dealing with the
- resume of a session.
-
-- Added the MIXED define. When set, the proxy will let all logs go
- to the standard error. This is useful to interleave the Xlib log
- output with the proxy output in a single file.
-
-- Added a new alert to report an I/O error at agent reconnection.
- This is one of those alert that can't be actually shown, but are
- included to offer a consistent view to the agent implementation.
-
-nxcomp-1.5.0-56
-
-- Added the split mode NXSplitModeSync. By selecting this mode,
- the proxy will try to empty the split store immediately, until
- all messages marked in such mode will be synchronized. The im-
- plementation is left to future versions.
-
- #define NXSplitModeSync 3
-
-- Added the messages specific to RDP and VNC sessions in NXalert.h.
- Included are also a few alerts related to changes to the color
- depth and desktop geometry that may be eventually mandated by the
- remote server.
-
-- Corrected a typo in NXalert.h
-
-nxcomp-1.5.0-55
-
-- Added the 'mode' field in the X_NXStartSplit request. It determi-
- nes the strategy that the proxy will adopt to handle the image.
- If set to 'eager', the proxy will only split the messages whose
- size exceeds the split threshold (the threshold can be found in
- the X_NXGetControlParameters reply). If mode is set to lazy, the
- proxy will split any image that it is not able to find in its
- cache.
-
- The opcode and the two available modes are defined in NXproto.h,
- currently:
-
- #define NXSplitModeDefault 0
- #define NXSplitModeEager 1
- #define NXSplitModeLazy 2
-
-- All requests related to image streaming now carry a 'resource' id.
- The id is currently ignored by the proxy in the case of X_NXCom-
- mitSplit requests.
-
-- Added a new NXSetSplitMode() request. It determines the strategy
- that the proxy will adopt to stream the images. If set to 'eager'
- the proxy will only split the messages whose size exceeds the
- split threshold, otherwise it will split all the images, regard-
- less their size. This is in preparation of the lazy encoding in
- agent.
-
-- Slightly decreased the startup timeout compared to the value it
- had in the 1.4.0. This timeout is used to retain the images used
- during session startup in the persistent cache.
-
-nxcomp-1.5.0-54
-
-- Modified the text of the begin-reconnection alert to mention the
- speed of the connection detected by the agent.
-
-nxcomp-1.5.0-53
-
-- Reworked the handling of the abort-split events issued by the re-
- remote proxy so that we now finalize the procedure and restart the
- client asynchronously, in the middle of the write loop.
-
-nxcomp-1.5.0-52
-
-- Rewritten the internal interface to the notification events. There
- are now five different split notification events:
-
- NXNoSplitNotify The operation didn't cause any actual split.
- The client can be immediately restarted.
-
- NXStartSplitNotify A split is ongoing. The client should be
- suspended until the end of the split.
-
- NXCommitSplitNotify A complete request has been recomposed. The
- client can commit the given request to the
- X server.
-
- NXEndSplitNotify The split operation was duly completed. The
- client can be restarted.
-
- NXEmptySplitNotify No more split operation are pending. The
- agent can use this information to implement
- specific strategies, requiring for example
- that all messages have been recomposed at
- the remote end. This can include updating
- the drawables that were not synchronized
- because of the lazy encoding.
-
-- Removed the X_NXSync and X_NXKarma operations, not used anymore by
- the NX agents.
-
-- Increasing or decreasing a timeout makes it respectively equal to
- the base timeout or to the base timeout / 4.
-
-nxcomp-1.5.0-51
-
-- Improved the mechanism by which synchronization replies are sent
- to the X client proxy.
-
-- Using the leftPad field as passed by the nxagent 1.5.0-58 doesn't
- seem to work with the MIT-SHM. The workaround is to disable the
- MIT-SHM operation in the case of 1 bpp images.
-
-- Removed the limitation on the size of the shared memory segment
- that had been introduced for test purposes.
-
-nxcomp-1.5.0-50
-
-- Solved compilation problem when --with-info was not given.
-
-nxcomp-1.5.0-49
-
-- Improved support for color matching from 15 and 16 bpp to 24 and
- 32 bpp in RDP sessions.
-
-- Solved TR05C00910. This was about "shadows" that might appear in
- RDP sessions when small elements like tooltips were drawn.
-
-nxcomp-1.5.0-48
-
-- Added a 'commit' field in X_NXCommitSplit request. When zero, the
- X server side proxy will unlock the message in the message store,
- without actually committing the image to the X server. The new
- field required changes to the encoding. This means that this ver-
- sion is not compatible with older 1.5.0 nxcomp releases.
-
-- Added a new control message. This is used by NXTransFlush() to for-
- ce a roundtrip between the proxies and speed-up the handling of
- the synchronous replies.
-
-nxcomp-1.5.0-47
-
-- Made the timeouts dynamic, based on the user input and the current
- bitrate.
-
-- Set the available tokens to 8. This allows for 16 KB to be sent on
- a modem before having to wait for a reply.
-
-- Added provision for removing a dialog on the remote end. This can
- be used, for example, to get rid of a message that was displayed
- by the agent at the beginning of a lengthy operation.
-
-- Fixed a fault that arose when trying to run the proxy on a display
- whose name began with the 'nx' string.
-
-- Running a client or server session on a display host beginning with
- 'nx' should be now possible.
-
-- Flush is now always immediate when there is already data queued in
- the TCP socket.
-
-nxcomp-1.5.0-46
-
-- Created the NXalert.h header from Alert.h to share the alert codes
- with the agents. The new NXTransAlert() interface can be used to
- start an alert on the remote side.
-
-- Created the NXTransParse*() and NXTransCleanup() wrappers.
-
-- Temporarily using the single-dash style when passing parameters to
- nxclient until the double-dash style is fixed.
-
-nxcomp-1.5.0-45
-
-- Motion events are now flushed at the time the X server channel is
- sending the token reply.
-
-- Renamed NXDialog() to NXTransDialog() and added a window ID parame-
- ter, to be used by the agent when starting the "pulldown" dialogs.
-
-- Also renamed the other NX utility functions.
-
-nxcomp-1.5.0-44
-
-- Solved a bug that prevented auxiliary X connections from working
- with the agent.
-
-- Added the missing check on the proxy pointer in HandleTimer() as
- it may be actually called before the proxy is created.
-
-nxcomp-1.5.0-43
-
-- Started tuning the performance. For now, the available tokens are
- set to an improbable value of 10000.
-
-nxcomp-1.5.0-42
-
-- Disabled the X server side remote expose events for test purposes.
- This is intended uncover the display problems introduced by the
- new handling of exposures in the X11 agent.
-
-- Fixed some timestamp related functions to avoid rounding problems.
-
-- Moved the timestamps of split, frame and flush from the Control
- to the Proxy class.
-
-- Made the X server side proxy to skip updating the counters related
- to token management.
-
-- Made also the X server side use deferred flushes.
-
-- Modified handleFrame() to manage both pings and data frames and
- send the token before the actual write operation.
-
-- Cleaned the pseudo-files used to load the control parameters.
-
-- Cleaned up the FIXME's in the lower layers. More FIXME's remain in
- the frontend classes.
-
-- Added a further counter to the statistics tracking the number of
- network writes performed on the proxy link.
-
-nxcomp-1.5.0-41
-
-- Now the watchdog process doesn't kill the parent. The termination
- event is determined by monitoring the child. This is advisable to
- avoid interfering with the signal handling in agent.
-
-- The house-keeping process is not started if differential compres-
- sion (and thus caching of images) is disabled.
-
-- Wait for the watchdog to terminate before starting the house-keep-
- ing process.
-
-- Fixed the problem of gray stripes in white areas when using 15bpp
- RDP compression. This solves the TR06C00916.
-
-- Added a log in Message.cpp to tell when an image is removed from
- the memory cache.
-
-- Removed most of the logs. Only left the logs directly related to
- the deferred flushes.
-
-- Removed a warning due to a missing definition in NX.h.
-
-nxcomp-1.5.0-40
-
-- Added the signal '12' to the set of blocked signal on Cygwin. This
- is what is delivered to the application when it tries to create a
- shared memory segment when the cygserver is not running. The call
- later returns "Operation not implemented", only useful if you have
- survived to the signal.
-
-- Modified the configure script to not link against cygipc.
-
-- Improved error handling in the negotiation phase.
-
-- Reset the last signal received when aborting a connection attempt.
- Not doing that might cause a warning.
-
-nxcomp-1.5.0-39
-
-- Both channels and proxy can now deal with incomplete messages by
- waiting for the full data to become available. This is not going
- to work when the transport is connected to an agent that is run-
- ning in-process, so the timeout must be really small.
-
-- Made the main loop more compact by letting a single function read
- from proxy and channels. The same change applies to writing to
- descriptors that are reported to be ready.
-
-- Optimized the loop to report as ready the agent descriptors that
- have become available after the proxy execution phase.
-
-- Now the proxy will try to asynchronously read from its descriptor
- after having read from the channel.
-
-- Unified the routine setting the routines setting the read and write
- descriptors and the timeouts.
-
-- Unified the routine handling the channel events.
-
-- Reintroduced the last ping timestamp to avoid sending more than a
- single ping every PingTimeout milliseconds.
-
-- The cleanup procedure now waits for the watchdog and house-keeping
- processes to terminate.
-
-- Reverted the change occurred in 1.5.0-35 about the byte-ordering
- problem in decompression of PNG and JPEG images.
-
-- More coding about deferred flushes.
-
-- Relevant debug logs are enabled in the main loop, in the proxy and
- in the channel classes, so use only for testing.
-
-nxcomp-1.5.0-38
-
-- Started the implementation of deferred writes based on the new NX
- transport.
-
-- Solved a problem with the statistics file affecting the Windows
- platform. Basically it seems that Cygwin or the stdc++ library
- don't deal correctly with files that are reopened just after
- having unlinked them.
-
-- Implemented support for 15 bpp RDP bitmaps.
-
-- Added "rdpcolors" and "rdpcache" to the list of parameters that
- are ignored in ParseEnviromentOptions().
-
-- This version has lot of logs enabled and some forced cleanups in
- the case of unexpected conditions. Avoid to use it for long-last-
- ing test sessions.
-
-nxcomp-1.5.0-37
-
-- Now splitting of images is fully disabled when running with link
- LAN. Previously the split was not executed by the proxy, but the
- agent was configured to send the start/end sequence.
-
-- Added the check protecting the proxy from token underflow. In the
- previous code the check was left out to verify the conditions un-
- der which this event might be encountered.
-
-- NXTransWrite() and NXTransWriteVector() allocate a context before
- calling handleRead(), so they can correctly return in the case of
- a cleanup.
-
-nxcomp-1.5.0-36
-
-- Modified the channel write loop to interleave abort split events
- between the writes to the X server socket.
-
-nxcomp-1.5.0-35
-
-- Solved a byte-ordering problem in decompression of PNG and JPEG
- images.
-
-- Changed the handleToken() interface to make explicit if a token
- must be issued because of a ping.
-
-- Small fix to prevent a warning in Jpeg.cpp when TEST is enabled.
-
-nxcomp-1.5.0-34
-
-- Solved a few problems introduced by the rewrite of the read loops
- in channels.
-
-- Added definition of NXCollectInputFocusNotify.
-
-nxcomp-1.5.0-33
-
-- Implemented a new control flow system based on tokens exchanged bet-
- ween the proxies. When the clint side runs out of tokens it stops
- sending data until a new token is returned. Tokens are sent whenever
- the data written to the socket exceeds the amount of data set for a
- scheduled write, so the proxy is free to send a number of smaller
- frames before running out of tokens.
-
-- The reason the new system is introduced is because the old method
- had two outstanding problems:
-
- - It worked very well when the proxies were directly connected,
- but couldn't reliably detect a link congestion when tunneled
- over SSH.
-
- - In the attempt of reducing the data queued to the TCP layer, it
- didn't leverage all the available bandwidth.
-
-- Moved the final check on the state of the session at the end of
- execution stage, instead of the beginning. The signals sent by the
- user to request the statistics could be reset before the proxy had
- entered the right procedure.
-
-- Added the session type 'unix-rootless', to be used for single apps
- run with the agent in rootless mode.
-
-nxcomp-1.5.0-32
-
-- Modified the main loop to skip the select when I/O is possible on
- any of the agent descriptors or the proxy link.
-
-- Now the house-keeping process is allocated in the heap instead of
- the stack.
-
-nxcomp-1.5.0-31
-
-- The server channel now performs asynchronous reads from the display
- by interleaving them with data decoded from the remote proxy.
-
-- Improved the handling of the memory-to-memory transport.
-
-nxcomp-1.5.0-30
-
-- Redesigned the handling of the congestion events to work more re-
- liably and to report the events to the remote peer earlier.
-
-- Increased the size of the shared memory segment when the MIT-SHM
- extension is activated.
-
-- Solved a bug that prevented the ping timeout to work as expected.
-
-- Ensured that, when entering the main select(), neither the chan-
- nels or the proxy have pending messages in the read buffers.
-
-- There is now only a single case where we can have pending messa-
- ges, namely in the handling of the MIT-SHM events.
-
-- Solved a bug introduced by the 1.5.0-29 that made the proxy en-
- ter the select with a null timeout.
-
-- Renamed LINK_TYPE_AUTO to LINK_TYPE_NONE in NXproto.h.
-
-nxcomp-1.5.0-29
-
-- Now encoding data from the agent descriptors happens in the same
- context as data is written to the buffer.
-
-- Optimized the handling of the congestion events to avoid running
- further unneeded loops.
-
-- Added timer handling utilities.
-
-nxcomp-1.5.0-28
-
-- Added code providing information about the reason of the failure
- encountered connecting to the local X server. This greatly helps
- when troubleshooting X authorization problems.
-
-- On connection failure a warning message is printed in the session
- log.
-
-- Removed the warning that was previously printed when the MIT-SHM
- extension failed to be initialized on Windows. Shared memory has
- problems on Cygwin and it currently doesn't work in NXWin.
-
-- Reworked the message printed in the case of link failure.
-
-nxcomp-1.5.0-27
-
-- Solved a bug in the connection procedure introduced by 1.5.0-25.
-
-nxcomp-1.5.0-26
-
-- Transformed the errors printed on failure of the fork() creating
- the children into warnings. This can happen quite often on Win-
- dows, due to well known Cygwin problems. See also the ChangeLog
- entry for nxcomp 1.4.0-28. This patch closes the TRSL052278 but
- it's obviously not a long-term solution.
-
-- Set the sticky bit when creating the '/tmp/.X11-unix' directory.
-
-- Modified the Makefile.in to remove the *.out.* files generated by
- Valgrind.
-
-- Updated the README files.
-
-nxcomp-1.5.0-25
-
-- Changed the directory where the client for the Mac is searched if
- it is not found in the system path.
-
-- Modified Auth.cpp to use nxauth also on the Mac.
-
-- Reworked the procedure showing the alert dialog when a timeout is
- encountered in the initial connection.
-
-- Removed the experimental code from the official 1.5.0 branch.
-
-nxcomp-1.5.0-24
-
-- Implemented more experimental classes.
-
-nxcomp-1.5.0-23
-
-- Added the NX_SIGNAL_FORWARD action to NXTransSignal(). This can
- be used to let the proxy call the original signal handler of the
- agent after having blocked the signal.
-
-nxcomp-1.5.0-22
-
-- Ensured that we always have a context, even before creating the
- transport.
-
-- Suppressed the error message printed when passing the -h option.
-
-- Added the experimental code that is currently under development.
-
-nxcomp-1.5.0-21
-
-- Enabled the fake X cookie authentication. This requires checking
- the remote proxy version to verify that the server supports the
- new authorization mechanism.
-
-- It's worth noting that the X client side proxy doesn't care which
- cookie is sent over the connection. The problem is that clients
- connecting to 1.4.0 servers don't have a method to force the ser-
- ver to use the fake cookie. This means that we have to solve the
- problem by letting the proxy check the remote version so that it
- can omit to replace the cookie when connecting to older servers.
-
-nxcomp-1.5.0-20
-
-- Added the NXTransCongestion() function. It returns true if proxy
- is in congestion state.
-
-- Removed an incorrect warning that was printed when calling force()
- for the memory-to-memory transport. The agent could actually re-
- quire multiple loops to read all data queued for it.
-
-nxcomp-1.5.0-19
-
-- Small optimization in NXTransReadable() to run a new NXTransConti-
- nue() loop only after at least RetryTimeout milliseconds are pas-
- sed since the last call and still no data is available. This cuts
- the number of unneeded loops to 1/4th of the total, probably more,
- on faster machines.
-
-- Added NXCollectGrabPointerNotify to NXproto.h.
-
-nxcomp-1.5.0-18
-
-- Minor changes to NXTransContinue().
-
-nxcomp-1.5.0-17
-
-- Moved respawning of a new nxclient instance in the cleanup procedu-
- re. This ensures that the respawn is executed whatever is the rea-
- son of the session shutdown.
-
-- Added a method to force closure of a given channel in proxy.
-
-- Removed code handling the special case triggered on Windows by the
- presence of a NX_SESSION variable in the environment.
-
-nxcomp-1.5.0-16
-
-- Added the NXTransSignal() function to let agents tell to the proxy
- how to handle the standard POSIX signals. Given the SIGINT signal,
- for example, the caller can specify any of the following actions.
-
- NX_SIGNAL_ENABLE: A signal handler will have to be installed by
- the library, so that it can be intercepted by
- the proxy.
-
- NX_SIGNAL_DISABLE: The signal will be handled by the caller and,
- eventually, forwarded to the proxy by calling
- NXTransSignal() explicitly.
-
- NX_SIGNAL_RAISE: The signal must be handled now, as if it had
- been delivered by the operating system. This
- function can be called by the agent with the
- purpose of propagating a signal to the proxy.
-
- As a rule of thumb, agents should let the proxy handle SIGUSR1 and
- SIGUSR2, used for producing the NX protocol statistics, and SIGHUP,
- used for disconnecting the NX transport.
-
-- The following signals are blocked by default upon creation of the
- NX transport:
-
- SIGCHLD These signals should be always put under the control
- SIGUSR1 of the proxy. If agents are intercepting them, agents
- SIGUSR2 should later call NXTransSignal(..., NX_SIGNAL_RAISE)
- SIGHUP to forward the signal to the proxy.
-
- SIGINT These signals should be intercepted by agents. Agents
- SIGTERM should ensure that NXTransDestroy() is called before
- exiting, to give the proxy a chance to shut down the
- NX transport.
-
- SIGPIPE This signal is blocked by the proxy, but not used to
- implement any functionality. It can be handled by the
- NX agent without affecting the proxy.
-
- SIGALRM This is not blocked by the proxy, but could be used
- in future.
-
- SIGVTALRM These signals are not used and should not be used in
- SIGWINCH future versions of the library.
- SIGIO
- SIGTSTP
- SIGTTIN
- SIGTTOU
-
-- By calling NXTransSignal(..., NX_SIGNAL_DISABLE) nxcomp will res-
- tore the signal handler that was saved at the time the proxy hand-
- ler was installed. This means that you should call the function
- just after the XOpenDisplay() or any other function used to init-
- ialize the NX transport.
-
-nxcomp-1.5.0-15
-
-- In NXTransContinue(), if the transport is gone, return immediately,
- that is without having to wait until the NXTransSelect() timeout.
-
-- Ensure that NXTransCreate() has a jump context, just in the case
- a subsequent operation would cause a cleanup.
-
-nxcomp-1.5.0-14
-
-- Solved a problem with requests left in the agent's buffer when run-
- ning the NX transport. The agent could have enqueued data to our
- side and checked the available events but requests could not be
- written to the proxy because proxy might not have had a chance to
- enter a new select. We found that this behaviour was triggered by
- _XEventsQueued, so now a new loop is forced when agent is calling
- _X11TransDataReadable. The procedure can be optimized, by avoiding
- an expensive loop when no critical I/O is pending.
-
-- Added a few additional logs to ClientChannel and ServerChannel.
-
-nxcomp-1.5.0-13
-
-- Added the code handling the special cases of an user not specifying
- a proxy cookie or the case of the X authorization file not contain-
- ing a value matching the display. In the first case we'll forward
- the same cookie that was feeded to the proxy, in the second case we
- will forward to the X server a random generated cookie, similarly to
- what SSH does in this same condition.
-
-- Rewritten the command line parser. Removed all the command line
- options parsed on behalf of nxproxy except:
-
- -C Specify that nxproxy has to run on the "X client"
- side, listening for connections and impersonating
- an X server.\n\
-
- -S Specify that nxproxy has to run in "X server" mode,
- thus forwarding the connections to daemons running
- on the client.\n\
-
- -V n.n.n Request nxproxy to load the given nxcomp version.
- This option is only present on Solaris and Linux.
-
- -v Print version information.
-
- host:port Put at the end, specifies the host and port of the
- listening proxy.
-
- value=name Set the NX option to the provided value.
-
- Multiple NX options can be specified in the DISPLAY environment or
- on the command line, by using the nx/nx,name=value notation.
-
-- The above information is printed on the console when incurring in
- a parse error, together with a list of the available option=value
- parameters.
-
-- Renamed the 'log' option to 'errors'. This makes sense as the de-
- fault name for the log file is actually 'errors'.
-
-- Now the "Established X server connection" message is printed to
- the session log only after the X connection has passed the X auth-
- entication phase. This means that the NX client should become able
- to show the details of the session log whenever the session fails
- due to a cookie problem.
-
-- When selecting the additional services without specifying a port,
- the client proxy will now automatically forward the connections to
- the corresponding well-known ports of the CUPS, SMB and HTTP servi-
- ces. Embedded X keyboard connections will be automatically forward-
- ed to the same display port used to connect to the X server. The
- user will still have to specify the port to be used for the media
- connections as we don't have a suitable well-known port.
-
-- Starting from this version, connections to the keybd port will cre-
- ate real X connection channels. This is required to let connections
- leverage the fake authorization cookie.
-
-- By testing the forwarding of keybd connections I found that, when
- letting X clients connect to the port, it is required to provide
- the X cookie for the unix display. Adding only the TCP cookie will
- not work. For example, by creating a cookie as in:
-
- xauth add localhost:2009 MIT-MAGIC-COOKIE-1 6f...f4
-
- And running:
-
- xterm xterm -display localhost:2009
-
- You will get the following error:
-
- Xlib: connection to "localhost:2009.0" refused by server
- Xlib: No protocol specified
-
- Adding also the unix cookie will fix it:
-
- xauth add localhost/unix:2009 MIT-MAGIC-COOKIE-1 6f...f4
-
- This seems to be a Xlib problem, with Xlib trying to get the cookie
- for the UDS port even if the TCP port was requested by the user.
-
-- Fixed a bug that prevented the nxclient dialog to be displayed when
- the session was abruptedly shut down.
-
-- Fixed the compilation error on Apple MacOSX due to the sa_restorer
- field in sigaction. As long as this field is present on Linux we
- will keep following the safer route and will set it explicitly to
- NULL.
-
-- Included what needs to be included in Process.cpp to compile with
- older gcc.
-
-nxcomp-1.5.0-12
-
-- Implemented a replacement for the popen() and pclose() that do not
- rely on a shell to run the command. They were required on Windows,
- where we don't ship a suitable shell in the install.
-
-- Removed code forcing the PATH to include the bin directory on
- Windows.
-
-nxcomp-1.5.0-11
-
-- Forced Auth.cpp on Windows to have the directory containing the
- nxauth executable in the PATH. This is just for testing, until
- nxclient is fixed.
-
-- Fixed compilation errors on Cygwin and Sun.
-
-- Removed the NX_FORCE_* stubs.
-
-nxcomp-1.5.0-10
-
-- Modified the memory management policies in ReadBuffer to fit all
- the available bytes in a single buffer allocation.
-
-- The locateMessage() methods now give hints on the amount of data
- that has to be read.
-
-- The read loop in channel now doesn't yield in the case of prio-
- ritized messages. This is experimental.
-
-- Removed the check on isTimeToYield() between encodings of multi-
- ple messages. This is aimed at reducing the risk of leaving pen-
- ding messages in channels.
-
-- Modified the channels' read loop to always read all the available
- data.
-
-- Disabled the log output that was selected when compiling with the
- configure option --with-info. This leaves space for other log out-
- put to be selected for more up-to-date scopes.
-
-- Implemented the NXTransReadVector() and the NXTransWriteVector()
- functions to replace READV() and WRITEV().
-
-- Implemented memory-to-memory communication between the agent and
- the NX proxy by making use of the NXTransAgent() interface in the
- nx-X11/lib/X11/Xtranssock.c file.
-
-- Added a check in NXTransSelect() for the EBADF and, on Solaris,
- the EINVAL errors. It can happen in the X11 code that a descript-
- or has become invalid before it is removed from the managed set
-
-- Rewritten the signal handling functions to restore the old actions
- and masks when the NX transport is destroyed.
-
-- Added a NXTransAgent() function to let agents tell the proxy which
- descriptor must be used for the controlling connection. Setting a
- controlling connection has the effect of disabling further X client
- connections and makes the proxy terminate when the channel is shut
- down.
-
-- Solved a problem with setting the initial timeout in the select().
-
-- Modified the Makefile.in to not include -Wno-deprecated when compi-
- ling C programs.
-
-nxcomp-1.5.0-9
-
-- Fixed a problem that prevented the 1.5.0-8 to work on the NX server
- side.
-
-- This version has NX_FORCE_NULL_LISTEN_OPTION and NX_FORCE_NEW_SES-
- SION_OPTION undefined, so it should work in a way that is compati-
- ble with the old nxcomp.
-
-nxcomp-1.5.0-8
-
-- The new code comes with a preliminary integration of nxcomp with
- SSH. It is now possible to create the NX transport by just calling
- the "switch" command as in the following example:
-
- NX> 299 Switching connection to: NX options: ...
-
-- Other possible forms for the NX switch command are:
-
- NX> 299 Switching connection to: NX mode: ...
-
- NX> 299 Switching connection to: NX mode: ... options: ...
-
- Or just:
-
- NX> 299 Switching connection to: NX
-
- The "mode" parameter is there to provide a way to run both enc-
- rypted and unencrypted connections. Possible values are "encrypt-
- ed", "unencrypted" or "default", the latter being an alias for
- "encrypted". Unfortunately I was not able to test unencrypted
- connections, so this may or may not work.
-
-- The top-level process can create the NX transport layer by calling
- NXTransCreate(). The user has to set up a socket pair and pass the
- higher descriptor to nxcomp. nxcomp will later monitor its end, by
- reading and writing NX-encoded traffic. The user has to call the
- NXTransExecute() function as often as it is possible, by letting
- first NXTransPrepare() combine the sets of NX descriptors with the
- descriptors that are used inside its process. A custom NXTransSel-
- ect() is provided to optionally replace the original select(). This
- function saves the original error code and the number of selected
- descriptors upon exit, so the user can call it, restore the original
- values as they were returned by the select() and run the rest of
- the loop unmodified.
-
-- Future versions of the library should provide appropriate methods
- for passing data to and from the proxy by means of a memcpy(), so
- that it will be possible to remove the even minimal TCP overhead.
-
-- Note that integration is far from complete. More work is required
- especially to manage the shutdown cleanly, in a way that gives to
- SSH a chance to free its resources, and on adding facilities for
- handling SSH and NX signals in a single function.
-
-- Rewritten the initialization procedure to make possible to run the
- proxy in-process in an arbitrary connection manager, like SSH or a
- HTTP utility. The same functionality can be used to embed nxcomp in
- the NX agents, so that nxcomp has not to run in a separate process.
-
-- A new state-machine handles the advances through the connection
- stages until the remote proxy (or the forwarder process ) is auth-
- enticated, options have been negotiated and the session is started.
-
-- The option "session" is now used to pass the name of the session
- file to the proxy. The parameter was previously used to pass the
- literal name of the session, as set by the user, and was ignored
- by the proxy. By default the session log is the standard error of
- the process. It is anyway required to set the option when running
- inside SSH, otherwise output will go to the same file as the SSH
- output. In the NX client this would be the 'sshlog' file.
-
-- This version can be easily crafted to test the new integration by
- setting the following define:
-
- NX_FORCE_NULL_LISTEN_OPTION
-
- This makes possible to test the nxcomp/nxssh integration by using
- any production 1.4.0 client. To run this version you are required
- to use nxproxy 1.5.0-4 and nxssh-1.5.0-6.
-
-- New functions handling enabling and disabling signals, based on
- sigprocmask().
-
-- Improved error reporting when failures are encountered while ne-
- gotiating the session.
-
-nxcomp-1.5.0-7
-
-- Caches are saved with a version identifier 1.4.0 so that they are
- not discarded after upgrading the software to the 1.5.0.
-
-- Made values of T_* enumerations to be all lower case.
-
-- Updated copyright to year 2005.
-
-- Started working on an interface for running nxcomp in-process, as
- a additional transport layer of nxssh or nxagent.
-
-nxcomp-1.5.0-6
-
-- Modified the configure script and the makefiles to not include the
- -Wstrict-prototypes and -Wmissing-prototypes compilation flags. The
- -Wnested-externs and -Wmissing-declarations flags are not included
- when using GCC 3.
-
-- Removed the initial newline from string "NXPROXY - Version" printed
- at program startup.
-
-- Made X authentication compatible with 1.4.0 clients. This is a tem-
- porary solution while code is updated to handle the new X authori-
- zation scheme.
-
-nxcomp-1.5.0-5
-
-- Added an Auth class to handle the X authentication. The NX server
- should now use the same proxie cookie that is passed by the client
- at session startup. The X server side proxy will forward the autho-
- rization credentials by replacing the fake cookie with the real co-
- okie, as it is read from the auth file using the xauth utility. The
- implementation is based on the corresponding code found in the SSH
- client and comes with the same limitations: only MIT-MAGIC-COOKIE-1
- cookies are checked and the authorization file is read only once,
- at the time the instance is initialized. If the auth file changes
- along the life of the session, the old cookie will still be used.
- This works with X servers because of an undocumented "feature".
- See also nx-X11.
-
-nxcomp-1.5.0-4
-
-- Adjusted for alarm(0) returning an inconsistent value in ConnectTo-
- Remote().
-
-- Small changes to Types.h, Jpeg.cpp and Png.cpp to compile with gcc
- 3.4.2.
-
-- Cosmetic changes to the ChangeLog file.
-
-nxcomp-1.5.0-3
-
-- Removed test code from ServerChannel.cpp.
-
-- Small cosmetic change in Loop.cpp.
-
-- Tested for compatibility against 1.4.1-8.
-
-nxcomp-1.5.0-2
-
-- Changed VERSION file according to TRCL052336.
-
-nxcomp-1.5.0-1
-
-- Opened the 1.5.0 branch based on 1.4.1-9.
-
-nxcomp-1.4.1-9
-
-- Implemented methods PACK_RDP_PLAIN_64K_COLORS and PACK_RDP_PLAIN_-
- 16M_COLORS. It seems that 16 bpp plain bitmaps can be seldom recei-
- ved. This doesn't seem to be the case of 24 bpp bitmaps.
-
-nxcomp-1.4.1-8
-
-- The new code enables use of 16 bpp and 32 bpp RDP bitmaps. This re-
- quired modifications to the following files:
-
- Misc.h
- Misc.cpp
- Loop.cpp
- Control.cpp
- ServerChannel.cpp
- Unpack.h
- Unpack.cpp
-
-- Lots of cosmetic changes compared to the original code in 1.4.1-7.
-
-- Merged the 1.4.0 and the 1.4.1 branches by importing changes up to
- the 1.4.1-7.
-
-nxcomp-1.4.0-30
-
-- Modified the function checking the Unix socket where X connections
- will be forwarded. The function will not fail if the socket itself
- doesn't exist yet. This solves the TRCL042203.
-
-- Moved the code checking for the CTRL+ALT+SHIFT+ESC sequence to a
- separate function. The implementation will now look for a different
- sequence on the MacOS/X platform. This should solve the TRCL042182.
-
-nxcomp-1.4.0-29
-
-- Solved a bug that could cause proxy to stop reading data from the
- X channels due to an incorrect calculation of the bytes queued on
- the proxy link. The bug only affected Linux kernels of the 2.0/2.2
- series.
-
-- Fixed a problem in the proxy class that could let the select time-
- out to become zero.
-
-nxcomp-1.4.0-28
-
-- Prevented the main proxy process from quitting when the fork() of
- any of the children fails. This can actually happen on Windows due
- to conflicts in reallocating any of the Cygwin DLLs.
-
-- Reworked handling of the priority flag in channels when dealing
- with the X_InternAtoms and X_AllocColor requests to reduce the time
- of session startup. Priority is never set in case of X_InternAtom
- requests and replies as we assume that most clients use the appro-
- priate Xlib function to pipeline multiple requests in a single net-
- work operation.
-
-- The timeout after which proxy will abort the peer connection is
- still 120 seconds. An alert dialog will be shown earlier, after 30
- seconds instead of 60.
-
-nxcomp-1.4.0-27
-
-- Removed the code setting priority on channels on ButtonPress and
- Button release events. It seems preferrable to delay the flush and
- pack more events in a single frame. This makes possible to get the
- ButtonRelease together with the ButtonPress.
-
-- Fixed error detection in SetNoDelay() where a positive result
- could produce a 'not supported' message in debug mode.
-
-nxcomp-1.4.0-26
-
-- Reworked the check aimed at detecting the clock drifts. The previ-
- ous code, introduced in 1.3.2-2, had the undesired side-effect of
- resetting the proxy timeout. This could cause the proxy to never
- detect that the other end had been killed.
-
-- The default behaviour of proxy is now to terminate the session at
- the time an error is encountered. This includes network failures.
-
-- Added a new dialog to be shown to the user whenever the session
- is terminated abnormally.
-
-nxcomp-1.4.0-25
-
-- Fixed a bug in handling of suppression of errors generated by
- committing the image splits. Other errors, unrelated to the commit
- of split, could be suppressed. This might cause the hangup of the
- session when the suppressed error was matching a reply.
-
-nxcomp-1.4.0-24
-
-- When killing the proxy process -9 the watchdog could remain alive.
- This caused the SSH link to keep the stderr open, with the effect
- that former proxy message were not flushed to the session log.
- Now the watchdog checks every second if the parent is dead, so
- that file descriptors can be closed as soon as possible.
-
-- SetupDisplaySocket() tried to force the connections to the X
- server on the UNIX port whenever the display was set to localhost.
- This patch was intended to fix a bug in nxclient, using the TCP
- port even when the display was set to a UNIX socket. This beha-
- viour caused problems when running nxclient on a remote host by
- means of a ssh -X. Proxy will now adhere to the display setting.
-
-nxcomp-1.4.0-23
-
-- Added the possibility to respawn nxclient at the end of session.
- This is an useful feature when powering thin-clients where NX
- is the only application made available.
-
-- This configuration applies system-wide to the local client ins-
- tallation. By default it is disabled. It can be enabled by the
- by creating a 'noexit' file in the directory '/usr/NX/share',
- or at compile time, by setting ENABLE_RESTART_ON_SHUTDOWN to 1.
-
-- Note that the solution is not perfect yet, as there are cases
- where session could die without going through HandleShutdown(),
- for example if a decoding error is raised in the communication
- with the remote peer and the subsequent restore of the proxy
- link fails to succeed.
-
-nxcomp-1.4.0-22
-
-- Corrected typos in Timestamp.h and Loop.cpp.
-
-nxcomp-1.4.0-21
-
-- Tuned the handling of RenderCompositeGlyphs. Now compression of
- RENDER shows an average ratio of 8:1. This is a steady increase
- compared to the 5:1 of the 1.3.2 version. The overall advantage
- when running clients displaying a large amount of text is 30%.
-
-nxcomp-1.4.0-20
-
-- Added a new message store for the CreatePixmap request.
-
-- Fixed handleCopy() to only send the data part past the offset.
- This fix can save a significant amount of traffic, especially
- when sending many small images whose size doesn't reach the
- threshold set for compressing them.
-
-nxcomp-1.4.0-19
-
-- Added tuning of all the RENDER requests. RenderCompositeGlyphs
- will require further work.
-
-- Completed porting of the RENDER requests to the new templates.
-
-nxcomp-1.4.0-18
-
-- Tuned the handling of RenderCreatePicture and RenderFreePicture.
-
-- Created a new template system for writing new message encoders.
-
-- Renamed getBits() in EncodeBuffer with diffBits(). The getBits()
- method now returns the bits actually allocated in the buffer and
- can be called multiple times.
-
-nxcomp-1.4.0-17
-
-- Provided specific encoding of the remaining RENDER requests and
- added compression of RenderCreateGlyphSet.
-
-nxcomp-1.4.0-16
-
-- Code underwent through 7 different patch versions but seems to
- be stable now. It still needs to provide specific encoding for
- RenderCreatePicture RenderChangePicture and RenderFreePicture.
- Code will likely include incompatible changes at any new version
- until the new encoding will stabilize, so be sure that you use
- the same nxcomp version at both sides.
-
-- Created the infrastructure for compressing extension messages
- based on the minor opcode. A new class, MinorMessageStore, has
- to be inherited by stores requiring specific compression, so
- that all the encoding methods of the parent can be redirected
- to it. The RENDER extension is now compressed using this new
- class.
-
-- Managed to maintain the compatibility with caches created by the
- 1.3.X version. Caches will be saved using the old format if the
- remote version is not a 1.4.x. When restoring a cache created
- by the 1.3.x with both proxies being the newest version, RENDER
- mesages will be discarded without having to discard the whole
- cache.
-
-- Added a member to the message class to store the identity size.
- This field is now used instead of the default data offset to
- manage the message data, that is the part of message after the
- identity.
-
-- Removed the warnings printed in the session log when passing the
- 'kbtype' and the 'geometry' options to the proxy. These options
- are actually used by agents.
-
-nxcomp-1.4.0-15
-
-- Started implementation of the new framework for handling enco-
- ding of X extensions.
-
-- Renamed the overloaded methods handleEncode() and handleDecode()
- to handleEncodeCached(), handleEncodeIdentity() and handleDecode-
- Cached(), handleDecodeIdentity().
-
-- Updated the copyright notice to year 2004.
-
-nxcomp-1.4.0-14
-
-- Added the new channel for HTTP connections. This channel can be
- used to let applications running on the NX server get access to
- data and applications made available by a HTTP daemon running at
- the client side.
-
- This channel is not used at the moment by nxclient. It can be
- activated by passing http=1 to the NX server side proxy and the
- value http=80 to the NX client side.
-
-nxcomp-1.4.0-13
-
-- Quick patch to run on MacOS/X where inet_addr("127.0.0.1")
- alone seems to fail to return a valid interface.
-
-nxcomp-1.4.0-12
-
-- Few cosmetic changes to logging.
-
-- Removed the debug output.
-
-nxcomp-1.4.0-11
-
-- Removed code used for simulating the new forwarding function-
- ality without client and server support.
-
-nxcomp-1.4.0-10
-
-- Implemented authentication of the forwarder to the listening
- proxy. If a session cookie is required, the forwarder must
- provide the cookie upon connection.
-
- An authentication phase at the time the forwarder connects
- to the NX client side is strongly suggested because it is usu-
- ally this side that sends the authorization cookie. Without
- such a forwarder authentication, the local peer would reveal
- the cookie to the first process connecting to the port.
-
-- If no cookie is specified in the switch command, the forward-
- er is required to skip the authentication phase. This can be
- useful when running the programs on the command line.
-
-- The implementation required appropriate changes to session
- negotiation in nxssh. This version requires nxssh-1.4.0-8.
-
-nxcomp-1.4.0-9
-
-- Fixed the startup procedure to correctly negotiate the cookie
- when the X server side proxy is listening for a forwarder.
-
-- When listening for a local forwarder (that is when the listen
- option is enabled at X server side), proxy will listen for the
- forwarder on the localhost interface.
-
-- This version has ports and and other parameters hardcoded for
- testing purposes and is not intended for normal use.
-
-nxcomp-1.4.0-8
-
-- Slightly modified the text of FAILED_PROXY_CONNECTION alert.
-
-nxcomp-1.4.0-7
-
-- Added provision for leaving a running dialog showing an OK box
- if proxy is exiting abnormally. This seems to fail to yield the
- expected results as, at the present moment, client checks if
- parent has exited.
-
-- Added a Binder class invoked when calling proxy with -B option.
- It would serve as a replacement of the modifications I'm doing
- in nxssh. The class is just a framework and the implementation
- is unfinished.
-
-nxcomp-1.4.0-6
-
-- Added a line in the session log if the connection procedure is
- aborted due to a signal.
-
-- Fixed ParseHostOption() to let it take in account the proxy
- port offset when passing 'host:port' as the last parameter at
- X server side.
-
-nxcomp-1.4.0-5
-
-- Lowered the default port offsets used for CUPS and SMB services
- to 2000 and 3000. Arbitrary ports can be used by passing the ser-
- vice's port at proxy startup. By default, anyway, the port is at
- the same offset of the proxied display. Considering that the NX
- server uses to start the first session at display 1000, we must
- lower some of the defaults to avoid interference with the normal
- X sessions run on the server.
-
- Session at display ":1000" will have:
-
- . Forwarding of CUPS connections at 3000.
-
- . Forwarding of SMB connections at 4000.
-
- . The listening proxy (at NX server side) at 5000. This
- port is not used when enabling SSH tunneling
-
- . The proxied X display (NX agent or proxy) at 7000.
-
- . Forwarding of multimedia channels at 8000.
-
- . Forwarding of embedded keyboard connections at 9000.
-
-- Turned off the log output.
-
-nxcomp-1.4.0-4
-
-- Managed to get the X client side proxy connect to the remote
- peer. This means that some parameters that were implicitly
- assumed based on the proxied port simulating the X display
- must be now specified in the NX display string.
-
-- The 'port' parameter now specifies the remote TCP port where
- the local proxy will connect to the remote peer. In previous
- versions this parameter also affected the proxied port. This
- was mainly a side effect, as the remote peer was always con-
- tacted at port 4000 plus the proxied display offset.
-
-- Added the 'listen' parameter to tell to the proxy that is go-
- ing to accept the peer connection on which port it will be
- contacted. By default, similarly to the previous version, the
- proxy will listen at the proxied display offset.
-
-- A check has been added in order to disallow passing both the
- 'accept' and the 'connect' parameter at the same time. A simi-
- lar check affects the 'listen' parameter.
-
-- Renamed the previously unused 'sync' channel as 'cups'.
-
-nxcomp-1.4.0-3
-
-- Preserved the ability of version 1.3.2 to load caches generated
- by this version.
-
-nxcomp-1.4.0-2
-
-- Small fixes to compile under Solaris 8.
-
-nxcomp-1.4.0-1
-
-- Opened the 1.4.0 branch.
-
-nxcomp-1.3.2-4
-
-- Fixed a problem with shmget(). Code in ServerChannel checked
- the return value for being greater then 0, while 0 can actual-
- ly be a valid segment.
-
-- When memory cache is disabled, nxcomp will explicitly set the
- appropriate control variables dealing with loading and saving
- of the persistent cache. This can be considered a cosmetic
- change as nxcomp will disable NX delta compression if memory
- cache is not available and this has an implicit effect on the
- ability to load and save such a cache.
-
-nxcomp-1.3.2-3
-
-- Removed inclusion of zlib.h in Png.cpp. Conflicting symbols
- with zlib.h from nx-X11 could cause compilation to fail.
-
-nxcomp-1.3.2-2
-
-- Added a function to take into account the clock drifts at the
- time we check the ping from the remote proxy. This can be
- caused by the user changing the system time or by small adjust-
- ments introduced by the operating system making the clock go
- backward. Such events could cause the proxy link to be shut
- down and reconnected.
-
-- Reduced the length of lines printed in statistics when showing
- the details of X protocol's opcodes. This is intended to help
- nxclient to keep the whole statistics in the 'details' window,
- so that users don't have to use the scrollbars.
-
-nxcomp-1.3.2-1
-
-- Opened the 1.3.2 branch.
-
-nxcomp-1.3.1-5
-
-- It seems that Solaris can return an EINVAL error selecting a
- shutdown descriptor even before we actually close the socket.
- We now ignore the condition on Solaris. This is definitely a
- Solaris bug.
-
-nxcomp-1.3.1-4
-
-- Increased the timeout after which proxy will abort the peer
- connection to 120 seconds. An alert dialog will now be shown
- after 60 seconds, instead of the 30 seconds being the default
- in the previous version. Some users reported the timeout to
- be too short in the case of temporary network failures.
-
-nxcomp-1.3.1-3
-
-- Some optimizations in the cache house-keeping process. Now it
- runs at lower system priority in respect to the parent. Any 2
- iterations through directories and images, it also sleeps for
- a tiny amount of time. This further decreases the system load.
-
-- Removed the underline characters and added a colon in the
- title of this ChangeLog to fully comply with format used in
- the release notices.
-
-nxcomp-1.3.1-2
-
-- Fixed a crash when running both client and server on the SPARC
- Solaris. An optimization used to avoid byte-swapping when both
- hosts have the same endianess doesn't work on SPARC if buffer
- is not aligned to word boundary. A better version of the code
- should check the CPU, not the OS, as this probably applies to
- other processors.
-
-nxcomp-1.3.1-1
-
-- Opened the 1.3.1 branch.
-
-nxcomp-1.3.0-50
-
-- Disabled the processor limit in X client side proxy. In previous
- versions the processor load limit was set to an idle time ratio
- of 2. This was likely to cause an unwanted slowdown on very old
- hardware or when running the server as guest OS inside a VMWare
- virtual machine.
-
-nxcomp-1.3.0-49
-
-- Last minute update on proxy shutdown bug on Cygwin. A stack
- trace reveals that faillure happens in the static destructor of
- the BlockCacheSet class. It seems that problem appeared just
- after having upgraded to the latest version of Cygwin DLL. Now
- the destructor is skipped at shutdown.
-
-nxcomp-1.3.0-48
-
-- Further fix to overcome the shutdown problem on Windows.
-
-nxcomp-1.3.0-47
-
-- Used T_files::value_type() in Keeper.cpp. The form without the
- explicit constructor fails to compile with GCC 2.91 on RH 6.2.
-
-- Fixed '==' -> '=' in configure.in to build under RH 6.2 and
- probably other platforms.
-
-nxcomp-1.3.0-46
-
-- The cleanup procedure now skips deletion of the IO streams
- under Windows. This is intended to overcome a strange segfault
- occurring at random time, at the time proxy is being shutdown.
-
-nxcomp-1.3.0-45
-
-- Newer versions of the stdlibc++ do not seem to be able to deal
- with NULL strings or non printable characters. This caused the
- standard error stream to get sometimes corrupted in the case
- TEST and DEBUG logs were enabled in Loop.cpp.
-
-nxcomp-1.3.0-44
-
-- Disabled TEST and DEBUG logs in ServerChannel.
-
-nxcomp-1.3.0-43
-
-- Fixed a crash when unpacking an image in server proxy in the
- case the unpack state for the given channel had not been
- previously created.
-
-nxcomp-1.3.0-42
-
-- Small modification to setSchedule() to not account previous
- data accumulated in the encode buffer. The new code seems to
- allow better use of the available bandwidth.
-
-nxcomp-1.3.0-41
-
-- Further fix in Tight decompression. Content of the main write
- buffer was not removed before flushing the unpacked data to
- the X server link.
-
-nxcomp-1.3.0-40
-
-- Removed the code marked as FIXME in Loop and ServerChannel.
- Code was used in previous version to override any pack method
- other than NO_PACK and to disable initialization of the shared
- memory.
-
-nxcomp-1.3.0-39
-
-- Solved the problem with unpacking of RDP text on big-endian
- architectures. The width field in PutPackedImage was put as
- 16 bits and extracted as 32 bits at decoding side.
-
-- Moved the code checking if any of the children has exited in a
- specific function. This function is now called any time signals
- are newly enabled. This works even on Solaris.
-
-- Enabled use of shared memory with Tight image decompression.
-
-- Added event NXCollectPropertyNotify to NXproto.h.
-
-nxcomp-1.3.0-38
-
-- Message locks are now checked before splitting a message.
-
-nxcomp-1.3.0-37
-
-- Added a further counter to yield encoding data if the amount
- of output bytes to be written to channels exceeds a threshold.
-
-- Modified proxy to write data immediately if the encoding loop
- was interrupted.
-
-nxcomp-1.3.0-36
-
-- Further fix required by Tight decompression. By handling mul-
- tiple writes in the Tight class we may flush the main write
- buffer in the wrong order. If Tight decompression is enabled,
- the buffer is now flushed before decoding the packed image.
-
-- A SIGCHLD is raised any time signals are newly enabled. This
- allows the main loop to wait() the pid of children that had
- exited while signals were disabled.
-
-nxcomp-1.3.0-35
-
-- Fixed Tight decompression by handling multiple writes to the
- channel's transport inside the decompression function.
-
-- Made Tight decompressor in ServerChannel a pointer instead of
- an instance of the class. Class is allocated the first time it
- is referenced.
-
-- Rewritten handleUnpack() in ServerChannel to use a switch()
- on the pack method instead of multiple if().
-
-nxcomp-1.3.0-34
-
-- Disabled RENDER extension when running X agent sessions on
- the Solaris client. Problems seem to be caused by incompati-
- bilities in the implementation of RENDER on the Sun X server
- shipped by default. We did not test NX with the XFree86 X
- server, but it seems that, when using the Sun X server, even
- plain X clients don't make full use of the extension.
-
-nxcomp-1.3.0-33
-
-- Added 4 new fields to the X_NXGetControlParameters reply.
- A dialog should be shown by agent if proxy was not able to
- negotiate a persistent cache or if a cache was selected but
- not loaded because incompatible or corrupted.
-
-- Fixed a bug on Solaris where socket() must be recreated if
- the first connect() fails. Not a problem. The strange thing
- is that if you reuse the socket(), the subsequent connect()
- is successful and the program fails as soon as you try to
- write to it.
-
-nxcomp-1.3.0-32
-
-- Added request X_NXFreeUnpack to free the resources allocated
- by the remote proxy to unpack images for the given agent's
- client
-
-- Added an alert at X server side if proxies were not able to
- negotiate a persistent cache or if a cache was selected but
- not loaded at X server side (that means that probably cache
- was not compatible or corrupted). The alert is not enabled
- at the moment. Before enabling it, we need to find a way to
- deal with full-screen mode.
-
-- Tuning of MIT-SHM parameters.
-
-nxcomp-1.3.0-31
-
-- Modified the following requests to carry the id of the
- agent's client:
-
- - X_NXSetUnpackGeometry
- - X_NXSetUnpackColormap
- - X_NXSetUnpackAlpha
- - X_NXPutPackedImage
-
- Now each agent's client has its own record pointing to the
- geometry, colormap and alpha channel that will be used to
- unpack the image. Code is not finished yet so it is advisable
- that agents' writers keep using client id 0. Note also that
- the final solution will require some changes to the way split
- notifications are sent to agent that I plan to implement in
- the next versions.
-
-- The X_NXSetUnpackGeometry request has now a message store.
- This should reduce the overhead to the minimum even in the
- case of dumb agents not checking if the current geometry
- matches the image to be unpacked.
-
-nxcomp-1.3.0-30
-
-- Improved handling of short-circuited replies at X client
- side. Request opcodes are now pushed in the sequence queue
- to determine if a reply is expected. In this case tainting
- of reply is skipped to preserve the sequence ordering of
- any event or error that could have generated by the reply.
- This seems to solve all the problems reported by people
- running a NX session in virtual desktop mode nested in an
- existing session being run in single application mode.
-
-- Modified the cleanup procedure to print the 'Waiting for'
- message in the session log only at the time all X channels
- have been actually shut down. This message can be used by
- the NX server to find out the appropriate time to close
- the session.
-
-- Added the selected session type to the 'Using pack method'
- message printed at startup.
-
-- Added the option to close down the proxy link and perform
- a clean shutdown of the session, re-read the whole session
- configuration or restart the proxy link when a SIGHUP is
- delivered to the proxy process. The default behaviour is
- to close down the session. The new default (the old one was
- to restart the link) is a required feature to let users run
- full sessions using single application mode f.e. in a LTSP
- environment. I noted that when the controlling terminal of
- the X session is closed, a SIGHUP is delivered to the X
- server side proxy (probably it is delivered to all the con-
- nected clients, and, thus for NX, only to the proxy). This
- signal can be used to terminate the whole session.
-
-nxcomp-1.3.0-29
-
-- Changed defaults to disable image masks when running proxy
- in single application mode. The new configuration requires
- changes in NX server and in NX X11 library. Users should
- experience much better image quality when using NX on slow
- links. This comes at the cost of slightly worse compression
- ratios.
-
-nxcomp-1.3.0-28
-
-- Opcode of request was not rewritten by server channel when
- using link LAN. This caused problems with taint of replies.
-
-nxcomp-1.3.0-27
-
-- Modified the split store and the split procedures in client
- channel to always return the client id in the notification
- events. The new field is added to event at byte offset 28
- to preserve compatibility with previous agent releases. The
- modification permits to agent to match the commit of alpha
- channel with the original image, if requests are split by
- proxy.
-
-- Temporarily set the timeout used to poll MIT-SHM completion
- events coming from X server to 0. More testing is required.
-
-- Fixed an inconsistent message generated in statistics due to
- a division by 0.
-
-nxcomp-1.3.0-26
-
-- Modified pending timeout from 1 to 0 milliseconds. This means
- that both channels and proxy are now immediately restarted to
- let them consume all data left in their read buffer.
-
-- When querying the X server for MIT-SHM support, size of name
- in X_QueryExtension request was sent as 32 bits instead of 16.
- This caused request to fail on big endian architectures.
-
-- Modified the MIT-SHM initialization procedure to always send
- all the 3 protocol requests also in the case of early failures.
-
-nxcomp-1.3.0-25
-
-- Implemented handling of the new X_NXSetUnpackAlpha message.
- Performances are very satisfactory. Using most of the current
- GNOME and KDE applications, caching reaches 90% of the total
- messages.
-
-- Modified the persistent cache management routines to handle
- backward compatibility with proxy versions prior of 1.3.0.
-
-- It has been made possible to send both X_NXSetUnpackColormap
- and X_NXSetUnpackAlpha messages with 0 entries to temporarily
- disable use of the colormap or the alpha channel and free the
- resources allocated by the server channel class.
-
-- Added function UnpackAlpha() to Unpack.cpp.
-
-nxcomp-1.3.0-24
-
-- Using WriteBuffer::registerPointer() to track growing of the
- write buffer in handleFastWrite() functions. This problem
- existed even in 1.2.2 but never shown up because we didn't
- have to use the pointer after data had been written to the
- write buffer. Now, instead, we have to post-process the write
- buffer to copy data to the shared segment.
-
-- Optimized memory allocations running with link LAN to save a
- memcpy() any time new data is allocated in the scratch buffer.
-
-- When running with link LAN the scratch buffer is now used only
- when:
-
- - A further allocation would case growing of the write buffer
- (and, thus, a memcpy() of the previous content).
-
- - When data to added is bigger than the write threshold.
-
- In previous versions the scratch buffer was used any time the
- total amount of data to be written (write buffer + scratch
- buffer) exceeded the scheduled write threshold. This caused
- small writes to be appended even when a single write could
- be obtained without reallocating the buffer.
-
-- Preliminary support for transporting the alpha channel in a
- separate message in case of 32 bits displays using the RENDER
- extension.
-
-nxcomp-1.3.0-23
-
-- Modified the mask used to open the shared memory segment on
- OS/X to 0777. We have to better investigate why the previous
- 0600 mask doesn't work even if the user running the proxy is
- the same user running the X server.
-
-nxcomp-1.3.0-22
-
-- Implemented MIT-SHM support on LAN connections.
-
-- More MIT-SHM bug fixes.
-
-nxcomp-1.3.0-21
-
-- Better use of the shared segment through an improved
- algorithm leveraging the offset field of the X_ShmPutImage
- request. The new algorithm greatly reduces the amount of
- polls the proxy needs to perform to find if the completion
- event has arrived.
-
-- Implemented MIT-SHM support for X_PutImage requests.
-
-- Implemented option shmem=value. Use of this option is anyway
- discouraged. Proxy will allocate the shared memory segment
- based on the size of the in-memory cache set by the user.
- Use of MIT-SHM is disabled when user did set a memory cache
- smaller than 2MB (for example on the embedded client).
-
-- Rewritten post-processing of images in server channel loop.
-
-- Improved error handling to ensure we intercept all MIT-SHM
- X errors before they reach the NX agent.
-
-- Solved a problem that was causing channels to not reflect
- shared memory support flags set in control.
-
-nxcomp-1.3.0-20
-
-- Solved a compatibility problem when mixing proxy versions
- 1.2.2 and 1.3.0.
-
-nxcomp-1.3.0-18
-
-- Rewritten interfaces to shared memory initialization in
- client and server channel.
-
-- Server channel checks for the completion event until a
- timeout before reusing the shared memory segment.
-
-- Flush flag was not cleared after the write buffer had been
- flushed in handleWrite() of both client and server channels.
- This could lead to multiple fragmented writes, affecting
- the performances.
-
-- Added -lcygipc to linking on Windows platform.
-
-- Added a check on GCC version to see if -Wnested-externs
- -Wmissing-declarations are valid options.
-
-nxcomp-1.3.0-17
-
-- Implemented initial support for MIT-SHM extension in the
- network path between the X server proxy and the real X
- server. Presently it works only for X_NXPutPackedImages.
-
-- Modified configure.in to compile under FreeBSD.
-
-- Small changes to sources due to FreeBSD support.
-
-nxcomp-1.3.0-16
-
-- Fixed caching of RENDER extension on MacOS/X and Solaris.
-
-- Under Solaris an explicit call to EnableSignal() is needed
- at the end of the signal handler as raising a signal seems
- to reset the previous settings.
-
-- Can't find a way to get bytes queued for write on Solaris as
- both FIONWRITE and TIOCOUTQ don't seem to be available. This
- means that NX server on Solaris is only able to detect con-
- gestions on proxy link at the time a write fails with error
- EAGAIN.
-
-- Starting from this version, render extension messages are not
- automatically discarded from cache when running agent based X
- sessions. This is in preparation of render support introduced
- in this release.
-
-nxcomp-1.3.0-15
-
-- Changed default to force writes if X channels exceed buffer
- limits. This change was suggested by benchmarks performed on
- Win32.
-
-- Wrapped IO on cache files in functions performing better error
- checking.
-
-- General cleanup in handling of socket options for MacOS/X and
- Solaris.
-
-nxcomp-1.3.0-14
-
-- Corrupted persistent caches were not deleted in case loading
- of any of the message stores failed. To run further sessions
- on the same host, user had to delete the cache file manually.
-
-- Improved error handling in JPEG decompression. Now connection
- is reset in case of failure.
-
-- Before performing JPEG or PNG decompression, image is better
- checked to verify if loading from disk failed.
-
-- Improved error handling in case of failure loading persistent
- cache from disk. On MacOS/X istream -> fail() doesn't seem to
- work properly. This needs further investigation.
-
-- The default installation path of nxclient is searched under
- MacOS/X at the time nxclient is invoked in dialog mode.
-
-nxcomp-1.3.0-13
-
-- Fixed a (further) compilation problem under Solaris. Now static
- libraries are first searched under /usr/sfw/lib (in case Sun
- would decide to include them in future releases).
-
-nxcomp-1.3.0-12
-
-- Fixed parsing of command line when passing option -V.
-
-- Correctly detected ENOPROTOOPT when setting TCP_NODELAY socket
- option on MacOS/X and Solaris.
-
-nxcomp-1.3.0-11
-
-- Given option in configure to specify what needs to be built
- statically:
-
- --with-static-png enable static linking of PNG library
- --with-static-jpeg enable static linking of JPEG library
- --with-static-z enable static linking of Z library
-
-nxcomp-1.3.0-10
-
-- Fixed a problem in saving of persistent cache on big-endian
- machines.
-
-nxcomp-1.3.0-9
-
-- Testing with different settings to check if it's possible to
- increase the performances under Windows.
-
-- Solved a problem in parsing of options that prevented proxy
- to connect to a remote session running at port offset 0.
-
-- Fixed two warnings compiling on Solaris.
-
-- Changed configure.in to first check for nx-X11 includes
- and libraries. Added "/usr/openwin/bin/makedepend" to path
- searched for the executable.
-
-nxcomp-1.3.0-8
-
-- Small cleanup in configure.in and files modified by Gregorz
- Kryza to add support for Solaris.
-
-- A new configure script has been generated using autoconf-2.57-3.
-
-nxcomp-1.3.0-7
-
-- Added support for detection of Solaris in configure script.
- Now Makefile.in uses ranlib instead of ar.
-
-- Small changes in source and header files to support Solaris.
-
-nxcomp-1.3.0-4
-
-- Corrected a bug that could cause priority on proxy and channels
- to be not taken in account at the time proxy tries to determine
- if it's time to flush the proxy link.
-
-- Better implementation of abort split notification by X server
- proxy to its remote peer. The new implementation doesn't
- need to set a timeout and permits notifications to be received
- earlier.
-
-- Improved support for 'tainting' XSync() messages coming from
- X clients in single application mode. Now a X_GetInputFocus
- is sent to the real X server any n such messages received by
- proxy.
-
-- Included support for 15 bpp displays. It seems that handling
- them as 16 bpp it's OK.
diff --git a/nxcomp/COPYING b/nxcomp/COPYING
deleted file mode 100644
index d511905c1..000000000
--- a/nxcomp/COPYING
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/nxcomp/ChangeGCCompat.cpp b/nxcomp/ChangeGCCompat.cpp
deleted file mode 100644
index ca2973774..000000000
--- a/nxcomp/ChangeGCCompat.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#include "ChangeGCCompat.h"
-
-#include "ClientCache.h"
-
-#include "EncodeBuffer.h"
-#include "DecodeBuffer.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-#undef DUMP
-
-//
-// Here are the methods to handle messages' content.
-//
-
-int ChangeGCCompatStore::parseIdentity(Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const
-{
- ChangeGCCompatMessage *changeGC = (ChangeGCCompatMessage *) message;
-
- //
- // Here is the fingerprint.
- //
-
- changeGC -> gcontext = GetULONG(buffer + 4, bigEndian);
- changeGC -> value_mask = GetULONG(buffer + 8, bigEndian);
-
- //
- // Clear the unused bytes carried in the
- // payload to increase the effectiveness
- // of the caching algorithm.
- //
-
- if ((int) size > dataOffset)
- {
- #ifdef DEBUG
- *logofs << name() << ": Removing unused bytes from the "
- << "data payload.\n" << logofs_flush;
- #endif
-
- changeGC -> value_mask &= (1 << 23) - 1;
-
- unsigned int mask = 0x1;
- unsigned char *source = (unsigned char *) buffer + CHANGEGC_DATA_OFFSET;
- unsigned long value = 0;
-
- for (unsigned int i = 0; i < 23; i++)
- {
- if (changeGC -> value_mask & mask)
- {
- value = GetULONG(source, bigEndian);
-
- value &= (0xffffffff >> (32 - CREATEGC_FIELD_WIDTH[i]));
-
- PutULONG(value, source, bigEndian);
-
- source += 4;
- }
-
- mask <<= 1;
- }
- }
-
- #ifdef DEBUG
- *logofs << name() << ": Parsed Identity for message at "
- << this << ".\n" << logofs_flush;
- #endif
-
- return 1;
-}
-
-int ChangeGCCompatStore::unparseIdentity(const Message *message, unsigned char *buffer,
- unsigned int size, int bigEndian) const
-{
- ChangeGCCompatMessage *changeGC = (ChangeGCCompatMessage *) message;
-
- //
- // Fill all the message's fields.
- //
-
- PutULONG(changeGC -> gcontext, buffer + 4, bigEndian);
- PutULONG(changeGC -> value_mask, buffer + 8, bigEndian);
-
- #ifdef DEBUG
- *logofs << name() << ": Unparsed identity for message at "
- << this << ".\n" << logofs_flush;
- #endif
-
- return 1;
-}
-
-void ChangeGCCompatStore::dumpIdentity(const Message *message) const
-{
- #ifdef DUMP
-
- ChangeGCCompatMessage *changeGC = (ChangeGCCompatMessage *) message;
-
- *logofs << name() << ": Identity gcontext " << changeGC -> gcontext
- << ", mask " << changeGC -> value_mask << ", size "
- << changeGC -> size_ << ".\n" << logofs_flush;
- #endif
-}
-
-void ChangeGCCompatStore::identityChecksum(const Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const
-{
- md5_append(md5_state_, buffer + 4, 8);
-}
diff --git a/nxcomp/ChangeGCCompat.h b/nxcomp/ChangeGCCompat.h
deleted file mode 100644
index 3a7b0c0a9..000000000
--- a/nxcomp/ChangeGCCompat.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef ChangeGCCompat_H
-#define ChangeGCCompat_H
-
-#include "Message.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-#undef DUMP
-
-//
-// Set default values.
-//
-
-#define CHANGEGC_ENABLE_CACHE 1
-#define CHANGEGC_ENABLE_DATA 0
-#define CHANGEGC_ENABLE_SPLIT 0
-#define CHANGEGC_ENABLE_COMPRESS 0
-
-#define CHANGEGC_DATA_LIMIT 144
-#define CHANGEGC_DATA_OFFSET 12
-
-#define CHANGEGC_CACHE_SLOTS 3000
-#define CHANGEGC_CACHE_THRESHOLD 3
-#define CHANGEGC_CACHE_LOWER_THRESHOLD 1
-
-//
-// The message class.
-//
-
-class ChangeGCCompatMessage : public Message
-{
- friend class ChangeGCCompatStore;
-
- public:
-
- ChangeGCCompatMessage()
- {
- }
-
- ~ChangeGCCompatMessage()
- {
- }
-
- //
- // Put here the fields which constitute
- // the 'identity' part of the message.
- //
-
- private:
-
- unsigned int gcontext;
- unsigned int value_mask;
-};
-
-class ChangeGCCompatStore : public MessageStore
-{
- //
- // Constructors and destructors.
- //
-
- public:
-
- ChangeGCCompatStore() : MessageStore()
- {
- enableCache = CHANGEGC_ENABLE_CACHE;
- enableData = CHANGEGC_ENABLE_DATA;
- enableSplit = CHANGEGC_ENABLE_SPLIT;
- enableCompress = CHANGEGC_ENABLE_COMPRESS;
-
- dataLimit = CHANGEGC_DATA_LIMIT;
- dataOffset = CHANGEGC_DATA_OFFSET;
-
- cacheSlots = CHANGEGC_CACHE_SLOTS;
- cacheThreshold = CHANGEGC_CACHE_THRESHOLD;
- cacheLowerThreshold = CHANGEGC_CACHE_LOWER_THRESHOLD;
-
- messages_ -> resize(cacheSlots);
-
- for (T_messages::iterator i = messages_ -> begin();
- i < messages_ -> end(); i++)
- {
- *i = NULL;
- }
-
- temporary_ = NULL;
- }
-
- virtual ~ChangeGCCompatStore()
- {
- for (T_messages::iterator i = messages_ -> begin();
- i < messages_ -> end(); i++)
- {
- destroy(*i);
- }
-
- destroy(temporary_);
- }
-
- virtual const char *name() const
- {
- return "ChangeGCCompat";
- }
-
- virtual unsigned char opcode() const
- {
- return X_ChangeGC;
- }
-
- virtual unsigned int storage() const
- {
- return sizeof(ChangeGCCompatMessage);
- }
-
- //
- // Message handling methods.
- //
-
- public:
-
- virtual Message *create() const
- {
- return new ChangeGCCompatMessage();
- }
-
- virtual Message *create(const Message &message) const
- {
- return new ChangeGCCompatMessage((const ChangeGCCompatMessage &) message);
- }
-
- virtual void destroy(Message *message) const
- {
- delete (ChangeGCCompatMessage *) message;
- }
-
- virtual int parseIdentity(Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const;
-
- virtual int unparseIdentity(const Message *message, unsigned char *buffer,
- unsigned int size, int bigEndian) const;
-
- virtual void identityChecksum(const Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const;
-
- virtual void dumpIdentity(const Message *message) const;
-};
-
-#endif /* ChangeGCCompat_H */
diff --git a/nxcomp/Colormap.h b/nxcomp/Colormap.h
deleted file mode 100644
index e0056f86c..000000000
--- a/nxcomp/Colormap.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef Colormap_H
-#define Colormap_H
-
-int UnpackColormap(unsigned char method, unsigned char *src_data, int src_size,
- unsigned char *dst_data, int dst_size);
-
-#endif /* Colormap_H */
diff --git a/nxcomp/CreatePixmapCompat.cpp b/nxcomp/CreatePixmapCompat.cpp
deleted file mode 100644
index 6ea346ee1..000000000
--- a/nxcomp/CreatePixmapCompat.cpp
+++ /dev/null
@@ -1,272 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#include "CreatePixmapCompat.h"
-
-#include "ClientCache.h"
-
-#include "EncodeBuffer.h"
-#include "DecodeBuffer.h"
-
-#include "WriteBuffer.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-
-//
-// Constructors and destructors.
-//
-
-CreatePixmapCompatStore::CreatePixmapCompatStore()
-
- : MessageStore()
-{
- enableCache = CREATEPIXMAP_ENABLE_CACHE;
- enableData = CREATEPIXMAP_ENABLE_DATA;
- enableSplit = CREATEPIXMAP_ENABLE_SPLIT;
- enableCompress = CREATEPIXMAP_ENABLE_COMPRESS;
-
- dataLimit = CREATEPIXMAP_DATA_LIMIT;
- dataOffset = CREATEPIXMAP_DATA_OFFSET;
-
- cacheSlots = CREATEPIXMAP_CACHE_SLOTS;
- cacheThreshold = CREATEPIXMAP_CACHE_THRESHOLD;
- cacheLowerThreshold = CREATEPIXMAP_CACHE_LOWER_THRESHOLD;
-
- messages_ -> resize(cacheSlots);
-
- for (T_messages::iterator i = messages_ -> begin();
- i < messages_ -> end(); i++)
- {
- *i = NULL;
- }
-
- temporary_ = NULL;
-}
-
-CreatePixmapCompatStore::~CreatePixmapCompatStore()
-{
- for (T_messages::iterator i = messages_ -> begin();
- i < messages_ -> end(); i++)
- {
- destroy(*i);
- }
-
- destroy(temporary_);
-}
-
-//
-// Here are the methods to handle messages' content.
-//
-
-int CreatePixmapCompatStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer,
- const unsigned int size, int bigEndian,
- ChannelCache *channelCache) const
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeCachedValue(*(buffer + 1), 8,
- clientCache -> depthCache);
-
- encodeBuffer.encodeDiffCachedValue(GetULONG(buffer + 4, bigEndian),
- clientCache -> createPixmapLastId, 29,
- clientCache -> createPixmapIdCache, 4);
-
- encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian),
- clientCache -> drawableCache);
-
- encodeBuffer.encodeCachedValue(GetUINT(buffer + 12, bigEndian), 16,
- clientCache -> createPixmapXCache, 8);
-
- encodeBuffer.encodeCachedValue(GetUINT(buffer + 14, bigEndian), 16,
- clientCache -> createPixmapYCache, 8);
-
- #ifdef TEST
- *logofs << name() << ": Encoded message. Size is "
- << size << ".\n" << logofs_flush;
- #endif
-
- return 1;
-}
-
-int CreatePixmapCompatStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer,
- unsigned int &size, int bigEndian, WriteBuffer *writeBuffer,
- ChannelCache *channelCache) const
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned char cValue;
- unsigned int value;
-
- size = 16;
-
- buffer = writeBuffer -> addMessage(size);
-
- decodeBuffer.decodeCachedValue(cValue, 8,
- clientCache -> depthCache);
-
- *(buffer + 1) = cValue;
-
- decodeBuffer.decodeDiffCachedValue(value,
- clientCache -> createPixmapLastId, 29,
- clientCache -> createPixmapIdCache, 4);
-
- PutULONG(value, buffer + 4, bigEndian);
-
- decodeBuffer.decodeXidValue(value,
- clientCache -> drawableCache);
-
- PutULONG(value, buffer + 8, bigEndian);
-
- decodeBuffer.decodeCachedValue(value, 16,
- clientCache -> createPixmapXCache, 8);
-
- PutUINT(value, buffer + 12, bigEndian);
-
- decodeBuffer.decodeCachedValue(value, 16,
- clientCache -> createPixmapYCache, 8);
-
- PutUINT(value, buffer + 14, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Decoded message. Size is "
- << size << ".\n" << logofs_flush;
- #endif
-
- return 1;
-}
-
-int CreatePixmapCompatStore::parseIdentity(Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const
-{
- CreatePixmapCompatMessage *createPixmap = (CreatePixmapCompatMessage *) message;
-
- createPixmap -> depth = *(buffer + 1);
-
- createPixmap -> id = GetULONG(buffer + 4, bigEndian);
- createPixmap -> drawable = GetULONG(buffer + 8, bigEndian);
-
- createPixmap -> width = GetUINT(buffer + 12, bigEndian);
- createPixmap -> height = GetUINT(buffer + 14, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Parsed identity. Size is "
- << createPixmap -> size_ << " identity is "
- << createPixmap -> i_size_ << ".\n"
- << logofs_flush;
- #endif
-
- return 1;
-}
-
-int CreatePixmapCompatStore::unparseIdentity(const Message *message, unsigned char *buffer,
- unsigned int size, int bigEndian) const
-{
- CreatePixmapCompatMessage *createPixmap = (CreatePixmapCompatMessage *) message;
-
- *(buffer + 1) = createPixmap -> depth;
-
- PutULONG(createPixmap -> id, buffer + 4, bigEndian);
- PutULONG(createPixmap -> drawable, buffer + 8, bigEndian);
-
- PutUINT(createPixmap -> width, buffer + 12, bigEndian);
- PutUINT(createPixmap -> height, buffer + 14, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Unparsed identity. Size is "
- << createPixmap -> size_ << " identity is "
- << createPixmap -> i_size_ << ".\n"
- << logofs_flush;
- #endif
-
- return 1;
-}
-
-void CreatePixmapCompatStore::dumpIdentity(const Message *message) const
-{
- #ifdef DUMP
-
- #ifdef WARNING
- *logofs << name() << ": WARNING! Dump of identity not implemented.\n"
- << logofs_flush;
- #endif
-
- #endif
-}
-
-void CreatePixmapCompatStore::identityChecksum(const Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const
-{
- md5_append(md5_state_, buffer + 1, 1);
- md5_append(md5_state_, buffer + 8, 8);
-}
-
-void CreatePixmapCompatStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message,
- const Message *cachedMessage,
- ChannelCache *channelCache) const
-{
- CreatePixmapCompatMessage *createPixmap = (CreatePixmapCompatMessage *) message;
- CreatePixmapCompatMessage *cachedCreatePixmap = (CreatePixmapCompatMessage *) cachedMessage;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeDiffCachedValue(createPixmap -> id,
- clientCache -> createPixmapLastId, 29,
- clientCache -> createPixmapIdCache, 4);
-
- cachedCreatePixmap -> id = createPixmap -> id;
-
- encodeBuffer.encodeXidValue(createPixmap -> drawable,
- clientCache -> drawableCache);
-
- cachedCreatePixmap -> drawable = createPixmap -> drawable;
-
- #ifdef TEST
- *logofs << name() << ": Encoded update. Size is "
- << createPixmap -> size_ << " identity is "
- << createPixmap -> i_size_ << ".\n"
- << logofs_flush;
- #endif
-}
-
-void CreatePixmapCompatStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message,
- ChannelCache *channelCache) const
-{
- CreatePixmapCompatMessage *createPixmap = (CreatePixmapCompatMessage *) message;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- decodeBuffer.decodeDiffCachedValue(createPixmap -> id,
- clientCache -> createPixmapLastId, 29,
- clientCache -> createPixmapIdCache, 4);
-
- decodeBuffer.decodeXidValue(createPixmap -> drawable,
- clientCache -> drawableCache);
-
- #ifdef TEST
- *logofs << name() << ": Decoded update. Size is "
- << createPixmap -> size_ << " identity is "
- << createPixmap -> i_size_ << ".\n"
- << logofs_flush;
- #endif
-}
diff --git a/nxcomp/CreatePixmapCompat.h b/nxcomp/CreatePixmapCompat.h
deleted file mode 100644
index e8cf8d99f..000000000
--- a/nxcomp/CreatePixmapCompat.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef CreatePixmapCompat_H
-#define CreatePixmapCompat_H
-
-#include "Message.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-#undef DUMP
-
-//
-// Set default values.
-//
-
-#define CREATEPIXMAP_ENABLE_CACHE 1
-#define CREATEPIXMAP_ENABLE_DATA 0
-#define CREATEPIXMAP_ENABLE_SPLIT 0
-#define CREATEPIXMAP_ENABLE_COMPRESS 0
-
-#define CREATEPIXMAP_DATA_LIMIT 16
-#define CREATEPIXMAP_DATA_OFFSET 16
-
-#define CREATEPIXMAP_CACHE_SLOTS 1000
-#define CREATEPIXMAP_CACHE_THRESHOLD 2
-#define CREATEPIXMAP_CACHE_LOWER_THRESHOLD 1
-
-//
-// The message class.
-//
-
-class CreatePixmapCompatMessage : public Message
-{
- friend class CreatePixmapCompatStore;
-
- public:
-
- CreatePixmapCompatMessage()
- {
- }
-
- ~CreatePixmapCompatMessage()
- {
- }
-
- //
- // Put here the fields which constitute
- // the 'identity' part of the message.
- //
-
- private:
-
- unsigned char depth;
-
- unsigned int id;
- unsigned int drawable;
-
- unsigned short width;
- unsigned short height;
-};
-
-class CreatePixmapCompatStore : public MessageStore
-{
- public:
-
- CreatePixmapCompatStore();
-
- virtual ~CreatePixmapCompatStore();
-
- virtual const char *name() const
- {
- return "CreatePixmapCompat";
- }
-
- virtual unsigned char opcode() const
- {
- return X_CreatePixmap;
- }
-
- virtual unsigned int storage() const
- {
- return sizeof(CreatePixmapCompatMessage);
- }
-
- //
- // Message handling methods.
- //
-
- protected:
-
- virtual Message *create() const
- {
- return new CreatePixmapCompatMessage();
- }
-
- virtual Message *create(const Message &message) const
- {
- return new CreatePixmapCompatMessage((const CreatePixmapCompatMessage &) message);
- }
-
- virtual void destroy(Message *message) const
- {
- delete (CreatePixmapCompatMessage *) message;
- }
-
- virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer,
- const unsigned int size, int bigEndian,
- ChannelCache *channelCache) const;
-
- virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer,
- unsigned int &size, int bigEndian, WriteBuffer *writeBuffer,
- ChannelCache *channelCache) const;
-
- virtual int parseIdentity(Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const;
-
- virtual int unparseIdentity(const Message *message, unsigned char *buffer,
- unsigned int size, int bigEndian) const;
-
- virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message,
- const Message *cachedMessage,
- ChannelCache *channelCache) const;
-
- virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message,
- ChannelCache *channelCache) const;
-
- virtual void identityChecksum(const Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const;
-
- virtual void dumpIdentity(const Message *message) const;
-};
-
-#endif /* CreatePixmapCompat_H */
diff --git a/nxcomp/Fork.h b/nxcomp/Fork.h
deleted file mode 100644
index 9df9f4041..000000000
--- a/nxcomp/Fork.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-//
-// Try again if the fork() fails, as it can happen
-// often on Cygwin.
-//
-
-extern int Fork();
diff --git a/nxcomp/FreeCache.h b/nxcomp/FreeCache.h
deleted file mode 100644
index 01fa42cd8..000000000
--- a/nxcomp/FreeCache.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef FreeCache_H
-#define FreeCache_H
-
-#include "IntCache.h"
-
-class FreeCache : public IntCache
-{
- public:
-
- FreeCache(unsigned int size)
-
- : IntCache(size)
- {
- }
-};
-
-#endif /* FreeCache_H */
diff --git a/nxcomp/LICENSE b/nxcomp/LICENSE
deleted file mode 100644
index 2b3203474..000000000
--- a/nxcomp/LICENSE
+++ /dev/null
@@ -1,37 +0,0 @@
-Copyright (c) 2001, 2010 NoMachine - http://www.nomachine.com/.
-
-NXCOMP library and NX extensions to X are copyright of NoMachine.
-Redistribution and use of this software is allowed according to the
-following terms:
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License Version 2, and
-not any other version, as published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA-
-BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, you can request a copy to NoMachine
-or write to the Free Software Foundation, Inc., 59 Temple Place, Suite
-330, Boston, MA 02111-1307 USA
-
-Parts of this software are derived from DXPC project. These copyright
-notices apply to original DXPC code:
-
-Redistribution and use in source and binary forms are permitted provi-
-ded that the above copyright notice and this paragraph are duplicated
-in all such forms.
-
-THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-Copyright (c) 1995,1996 Brian Pane
-Copyright (c) 1996,1997 Zachary Vonler and Brian Pane
-Copyright (c) 1999 Kevin Vigor and Brian Pane
-Copyright (c) 2000,2006 Gian Filippo Pinzari and Brian Pane
-
-All rights reserved.
diff --git a/nxcomp/Makefile.am b/nxcomp/Makefile.am
new file mode 100644
index 000000000..c1f6226bc
--- /dev/null
+++ b/nxcomp/Makefile.am
@@ -0,0 +1,21 @@
+SUBDIRS = src test
+
+pkgconfig_DATA = nxcomp.pc
+
+MAINTAINERCLEANFILES = \
+ $(srcdir)/autom4te.cache/* \
+ $(srcdir)/build-aux/* \
+ $(srcdir)/Makefile.in \
+ $(srcdir)/src/Makefile.in \
+ $(srcdir)/aclocal.m4 \
+ $(srcdir)/config.h.in \
+ $(srcdir)/config.h.in~ \
+ $(srcdir)/configure \
+ $(srcdir)/m4/libtool.m4 \
+ $(srcdir)/m4/lt~obsolete.m4 \
+ $(srcdir)/m4/ltoptions.m4 \
+ $(srcdir)/m4/ltsugar.m4 \
+ $(srcdir)/m4/ltversion.m4 \
+ $(NULL)
+
+DISTCLEANFILES=$(MAINTAINERCLEANFILES)
diff --git a/nxcomp/Makefile.in b/nxcomp/Makefile.in
deleted file mode 100644
index 434118b4e..000000000
--- a/nxcomp/Makefile.in
+++ /dev/null
@@ -1,279 +0,0 @@
-############################################################################
-# #
-# Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. #
-# #
-# NXCOMP, NX protocol compression and NX extensions to this software #
-# are copyright of NoMachine. Redistribution and use of the present #
-# software is allowed according to terms specified in the file LICENSE #
-# which comes in the source distribution. #
-# #
-# Check http://www.nomachine.com/licensing.html for applicability. #
-# #
-# NX and NoMachine are trademarks of Medialogic S.p.A. #
-# #
-# All rights reserved. #
-# #
-############################################################################
-
-#
-# Get these values from the configure script. The
-# version printed by the program should be derived
-# from the CHANGELOG. For example we may use the
-# following command:
-#
-# head -n 3 CHANGELOG | grep 'nxcomp-' | cut -d '-' -f 2-3
-#
-
-VERSION=@VERSION@
-LIBVERSION=@LIBVERSION@
-
-#
-# We would really like to enable all warnings, -Wredundant-decls,
-# though, gives a warning caused by pthread.h and unistd.h and
-# GCC 3.4 was changed in a way that it now complains about some
-# of the -W directives we used before (-Wmissing-declarations,
-# -Wnested-externs, -Wstrict-prototypes and -Wmissing-prototypes).
-#
-
-CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \
- -Wall -Wpointer-arith
-CXXINCLUDES =
-CXXDEFINES =
-
-#
-# C programs have their own CFLAGS.
-#
-
-CC = @CC@
-CCFLAGS = @CFLAGS@ @X_CFLAGS@ @DEFS@ \
- -Wall -Wpointer-arith
-CCINCLUDES =
-CCDEFINES =
-
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-
-#
-# Other autoconfigured settings, not used at the moment.
-#
-
-srcdir = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-man1dir = @mandir@/man1
-VPATH = @srcdir@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-#
-# This should be autodetected.
-#
-
-MAKEDEPEND = @MAKEDEPEND@
-DEPENDINCLUDES = -I/usr/include/c++ -I/usr/include/g++ -I/usr/include/g++-3
-
-.SUFFIXES: .cpp.c
-
-.cpp.o:
- $(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $<
-.c.o:
- $(CC) -c $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $<
-
-LIBRARY = Xcomp
-
-LIBNAME = lib$(LIBRARY)
-LIBFULL = lib$(LIBRARY).so.$(VERSION)
-LIBLOAD = lib$(LIBRARY).so.$(LIBVERSION)
-LIBSHARED = lib$(LIBRARY).so
-LIBARCHIVE = lib$(LIBRARY).a
-
-LIBCYGSHARED = cyg$(LIBRARY).dll
-LIBCYGARCHIVE = lib$(LIBRARY).dll.a
-
-all: depend @ALL@
-
-MSRC =
-
-CSRC = MD5.c \
- Pack.c \
- Vars.c
-
-CXXSRC = Loop.cpp \
- Children.cpp \
- Control.cpp \
- Misc.cpp \
- Socket.cpp \
- Fork.cpp \
- Pipe.cpp \
- List.cpp \
- Keeper.cpp \
- Timestamp.cpp \
- Transport.cpp \
- Statistics.cpp \
- Auth.cpp \
- Agent.cpp \
- Proxy.cpp \
- Channel.cpp \
- Message.cpp \
- Split.cpp \
- ClientProxy.cpp \
- ServerProxy.cpp \
- OpcodeStore.cpp \
- ClientStore.cpp \
- ServerStore.cpp \
- ChannelCache.cpp \
- ClientCache.cpp \
- ServerCache.cpp \
- ClientChannel.cpp \
- ServerChannel.cpp \
- GenericChannel.cpp \
- ReadBuffer.cpp \
- ProxyReadBuffer.cpp \
- ClientReadBuffer.cpp \
- ServerReadBuffer.cpp \
- GenericReadBuffer.cpp \
- EncodeBuffer.cpp \
- DecodeBuffer.cpp \
- WriteBuffer.cpp \
- SequenceQueue.cpp \
- IntCache.cpp \
- CharCache.cpp \
- XidCache.cpp \
- ActionCache.cpp \
- BlockCache.cpp \
- BlockCacheSet.cpp \
- StaticCompressor.cpp \
- TextCompressor.cpp \
- Unpack.cpp \
- Alpha.cpp \
- Colormap.cpp \
- Jpeg.cpp \
- Pgn.cpp \
- Bitmap.cpp \
- Rgb.cpp \
- Rle.cpp \
- Z.cpp \
- ChangeProperty.cpp \
- SendEvent.cpp \
- ChangeGC.cpp \
- CreateGC.cpp \
- CreatePixmap.cpp \
- SetClipRectangles.cpp \
- CopyArea.cpp \
- PolyLine.cpp \
- PolySegment.cpp \
- PolyFillRectangle.cpp \
- PutImage.cpp \
- TranslateCoords.cpp \
- GetImage.cpp \
- ClearArea.cpp \
- ConfigureWindow.cpp \
- PolyText8.cpp \
- PolyText16.cpp \
- ImageText8.cpp \
- ImageText16.cpp \
- PolyPoint.cpp \
- PolyFillArc.cpp \
- PolyArc.cpp \
- FillPoly.cpp \
- InternAtom.cpp \
- GetProperty.cpp \
- SetUnpackGeometry.cpp \
- SetUnpackColormap.cpp \
- SetUnpackAlpha.cpp \
- PutPackedImage.cpp \
- ShapeExtension.cpp \
- RenderExtension.cpp \
- GenericRequest.cpp \
- QueryFontReply.cpp \
- ListFontsReply.cpp \
- GetImageReply.cpp \
- GetPropertyReply.cpp \
- GenericReply.cpp \
- RenderGenericRequest.cpp \
- RenderCreatePicture.cpp \
- RenderChangePicture.cpp \
- RenderFreePicture.cpp \
- RenderPictureClip.cpp \
- RenderPictureTransform.cpp \
- RenderPictureFilter.cpp \
- RenderCreateGlyphSet.cpp \
- RenderFreeGlyphSet.cpp \
- RenderAddGlyphs.cpp \
- RenderComposite.cpp \
- RenderCompositeGlyphs.cpp \
- RenderFillRectangles.cpp \
- RenderTrapezoids.cpp \
- RenderTriangles.cpp \
- PositionCacheCompat.cpp \
- ChangeGCCompat.cpp \
- CreatePixmapCompat.cpp \
- SetUnpackColormapCompat.cpp \
- SetUnpackAlphaCompat.cpp \
- RenderCreatePictureCompat.cpp \
- RenderFreePictureCompat.cpp \
- RenderPictureClipCompat.cpp \
- RenderCreateGlyphSetCompat.cpp \
- RenderCompositeCompat.cpp \
- RenderCompositeGlyphsCompat.cpp
-
-MOBJ = $(MSRC:.c=.o)
-COBJ = $(CSRC:.c=.o)
-CXXOBJ = $(CXXSRC:.cpp=.o)
-
-$(LIBFULL): $(CXXOBJ) $(COBJ)
- $(CXX) -o $@ $(LDFLAGS) $(CXXOBJ) $(COBJ) $(LIBS)
-
-$(LIBLOAD): $(LIBFULL)
- rm -f $(LIBLOAD)
- ln -s $(LIBFULL) $(LIBLOAD)
-
-$(LIBSHARED): $(LIBFULL)
- rm -f $(LIBSHARED)
- ln -s $(LIBFULL) $(LIBSHARED)
-
-$(LIBARCHIVE): $(CXXOBJ) $(COBJ)
- rm -f $(LIBARCHIVE)
- ar clq $(LIBARCHIVE) $(CXXOBJ) $(COBJ)
- ranlib $(LIBARCHIVE)
-
-$(LIBCYGSHARED): $(LIBARCHIVE)
- $(CC) -shared -o $(LIBCYGSHARED) \
- -Wl,--out-implib=$(LIBCYGARCHIVE) \
- -Wl,--export-all-symbols \
- -Wl,--enable-auto-import \
- -Wl,--whole-archive $(LIBARCHIVE) \
- -Wl,--no-whole-archive $(LIBS) \
- $(LDFLAGS)
-
-$(LIBCYGARCHIVE): $(LIBCYGSHARED)
-
-depends: depend.status
-
-depend: depend.status
-
-depend.status:
- if [ -x $(MAKEDEPEND) ] ; then \
- $(MAKEDEPEND) $(CXXINCLUDES) $(CCINCLUDES) \
- $(DEPENDINCLUDES) -f Makefile $(MSRC) $(CSRC) \
- $(CXXSRC) 2>/dev/null; \
- fi
- touch depend.status
-
-install: install.bin install.man
-
-install.bin:
-
-install.man:
-
-clean:
- -rm -f *~ *.o *.bak *.orig *.rej st?????? core core.* *.out.* \
- @ALL@
-
-distclean: clean
- -rm -rf autom4te.cache config.status config.log \
- config.cache depend.status Makefile tags
diff --git a/nxcomp/PositionCacheCompat.cpp b/nxcomp/PositionCacheCompat.cpp
deleted file mode 100644
index 4a6a2cd63..000000000
--- a/nxcomp/PositionCacheCompat.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#include "Control.h"
-
-#include "PositionCacheCompat.h"
-
-PositionCacheCompat::PositionCacheCompat()
-{
- if (control -> isProtoStep7() == 0)
- {
- for (int i = 0; i < 32; i++)
- {
- base_[i] = new IntCache(8);
- }
-
- slot_ = 0;
- last_ = 0;
- }
-}
-
-PositionCacheCompat::~PositionCacheCompat()
-{
- if (control -> isProtoStep7() == 0)
- {
- for (int i = 0; i < 32; i++)
- {
- delete base_[i];
- }
- }
-}
diff --git a/nxcomp/PositionCacheCompat.h b/nxcomp/PositionCacheCompat.h
deleted file mode 100644
index 983e45382..000000000
--- a/nxcomp/PositionCacheCompat.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef PositionCacheCompat_H
-#define PositionCacheCompat_H
-
-#include "IntCache.h"
-
-class PositionCacheCompat
-{
- friend class EncodeBuffer;
- friend class DecodeBuffer;
-
- public:
-
- PositionCacheCompat();
- ~PositionCacheCompat();
-
- private:
-
- IntCache *base_[32];
-
- unsigned int slot_;
- short int last_;
-};
-
-#endif /* PositionCacheCompat_H */
diff --git a/nxcomp/README b/nxcomp/README
deleted file mode 100644
index f35cce6b5..000000000
--- a/nxcomp/README
+++ /dev/null
@@ -1,21 +0,0 @@
-README
-------
-
-Building
---------
-
-1. To compile:
-
- > tar zxvf nxcomp-X.Y.Z-N.tar.gz
- > cd nxcomp
- > ./configure
- > make
-
- You'll have to run gmake under Solaris.
-
-2. The 'make install' target is not currently supported
- in the Makefile, but it should be simple to fix.
-
-You need at least nxproxy and nxagent packages to enjoy this code. Check the
-NoMachine website at http://www.nomachine.com to get the latest release.
-
diff --git a/nxcomp/README-IPAQ b/nxcomp/README-IPAQ
deleted file mode 100644
index f9418635c..000000000
--- a/nxcomp/README-IPAQ
+++ /dev/null
@@ -1,21 +0,0 @@
-README-IPAQ
------------
-
-1. Install a cross-compiler for ARM. You can find detailed
- informations at:
-
- http://www.ailis.de/~k/knowledge/crosscompiling/toolchain.php
-
- There are also binaries needed to install the cross-compiler.
-
-2. Configure and compile libXcomp using:
-
- $ ./configure --with-ipaq
- $ make
-
- After compilation type:
-
- $ arm-linux-strip libXcomp.*
-
-3. Remember that you also need nxproxy to actually run your NX X
- session.
diff --git a/nxcomp/RenderCompositeCompat.cpp b/nxcomp/RenderCompositeCompat.cpp
deleted file mode 100644
index 5a1eff213..000000000
--- a/nxcomp/RenderCompositeCompat.cpp
+++ /dev/null
@@ -1,320 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-//
-// Include the template for
-// this message class.
-//
-
-#include "RenderCompositeCompat.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-
-#include MESSAGE_TAGS
-
-//
-// Message handling methods.
-//
-
-MESSAGE_BEGIN_ENCODE_SIZE
-{
- //
- // Strictly speaking this request doesn't have
- // a data part. We just encode the field from
- // offset 24 to 36 as they were data using an
- // int cache.
- //
-
- #ifdef TEST
- *logofs << name() << ": Encoded size with value "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_SIZE
-
-MESSAGE_BEGIN_DECODE_SIZE
-{
- size = MESSAGE_OFFSET + 12;
-
- buffer = writeBuffer -> addMessage(size);
-
- #ifdef TEST
- *logofs << name() << ": Decoded size with value "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_SIZE
-
-MESSAGE_BEGIN_ENCODE_MESSAGE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeCachedValue(*(buffer + 4), 8,
- clientCache -> renderOpCache);
-
- encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian),
- clientCache -> renderSrcPictureCache);
-
- encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian),
- clientCache -> renderSrcPictureCache);
-
- encodeBuffer.encodeXidValue(GetULONG(buffer + 16, bigEndian),
- clientCache -> renderSrcPictureCache);
-
- encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 20, bigEndian),
- clientCache -> renderLastX, 16,
- clientCache -> renderXCache, 11);
-
- encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 22, bigEndian),
- clientCache -> renderLastY, 16,
- clientCache -> renderYCache, 11);
-
- #ifdef TEST
- *logofs << name() << ": Encoded message. Type is "
- << (unsigned int) *(buffer + 1) << " size is "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_MESSAGE
-
-MESSAGE_BEGIN_DECODE_MESSAGE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- *(buffer + 1) = type;
-
- decodeBuffer.decodeCachedValue(*(buffer + 4), 8,
- clientCache -> renderOpCache);
-
- decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache);
-
- PutULONG(value, buffer + 8, bigEndian);
-
- decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache);
-
- PutULONG(value, buffer + 12, bigEndian);
-
- decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache);
-
- PutULONG(value, buffer + 16, bigEndian);
-
- decodeBuffer.decodeDiffCachedValue(value,
- clientCache -> renderLastX, 16,
- clientCache -> renderXCache, 11);
-
- PutUINT(clientCache -> renderLastX, buffer + 20, bigEndian);
-
- decodeBuffer.decodeDiffCachedValue(value,
- clientCache -> renderLastY, 16,
- clientCache -> renderYCache, 11);
-
- PutUINT(clientCache -> renderLastY, buffer + 22, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Decoded message. Type is "
- << (unsigned int) type << " size is " << size
- << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_MESSAGE
-
-MESSAGE_BEGIN_ENCODE_DATA
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- for (unsigned int i = MESSAGE_OFFSET, c = 0; i < size; i += 4)
- {
- #ifdef DEBUG
- *logofs << name() << ": Encoding long value "
- << GetULONG(buffer + i, bigEndian) << " with i = "
- << i << " c = " << c << ".\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeCachedValue(GetULONG(buffer + i, bigEndian), 32,
- *clientCache -> renderCompositeDataCache[c]);
-
- if (++c == 3) c = 0;
- }
-
- #ifdef TEST
- *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET
- << " bytes of data.\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_DATA
-
-MESSAGE_BEGIN_DECODE_DATA
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- for (unsigned int i = MESSAGE_OFFSET, c = 0; i < size; i += 4)
- {
- decodeBuffer.decodeCachedValue(value, 32,
- *clientCache -> renderCompositeDataCache[c]);
-
- #ifdef DEBUG
- *logofs << name() << ": Decoded long value " << value
- << " with i = " << i << " c = " << c << ".\n"
- << logofs_flush;
- #endif
-
- PutULONG(value, buffer + i, bigEndian);
-
- if (++c == 3) c = 0;
- }
-
- #ifdef TEST
- *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET
- << " bytes of data.\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_DATA
-
-MESSAGE_BEGIN_PARSE_IDENTITY
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- renderExtension -> data.composite.type = *(buffer + 1);
- renderExtension -> data.composite.op = *(buffer + 4);
-
- renderExtension -> data.composite.src_id = GetULONG(buffer + 8, bigEndian);
- renderExtension -> data.composite.msk_id = GetULONG(buffer + 12, bigEndian);
- renderExtension -> data.composite.dst_id = GetULONG(buffer + 16, bigEndian);
-
- renderExtension -> data.composite.src_x = GetUINT(buffer + 20, bigEndian);
- renderExtension -> data.composite.src_y = GetUINT(buffer + 22, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Parsed identity. Type is "
- << (unsigned int) renderExtension -> data.composite.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_PARSE_IDENTITY
-
-MESSAGE_BEGIN_UNPARSE_IDENTITY
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- *(buffer + 1) = renderExtension -> data.composite.type;
- *(buffer + 4) = renderExtension -> data.composite.op;
-
- PutULONG(renderExtension -> data.composite.src_id, buffer + 8, bigEndian);
- PutULONG(renderExtension -> data.composite.msk_id, buffer + 12, bigEndian);
- PutULONG(renderExtension -> data.composite.dst_id, buffer + 16, bigEndian);
-
- PutUINT(renderExtension -> data.composite.src_x, buffer + 20, bigEndian);
- PutUINT(renderExtension -> data.composite.src_y, buffer + 22, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Unparsed identity. Type is "
- << (unsigned int) renderExtension -> data.composite.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_UNPARSE_IDENTITY
-
-MESSAGE_BEGIN_IDENTITY_CHECKSUM
-{
- //
- // Include minor opcode, size and
- // operator in the identity, plus
- // the x and y of the source.
- //
-
- md5_append(md5_state, buffer + 1, 4);
- md5_append(md5_state, buffer + 20, 4);
-}
-MESSAGE_END_IDENTITY_CHECKSUM
-
-MESSAGE_BEGIN_ENCODE_UPDATE
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
- RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- #ifdef DEBUG
- *logofs << name() << ": Source " << renderExtension ->
- data.composite.src_id << " mask " << renderExtension ->
- data.composite.msk_id << " destination " << renderExtension ->
- data.composite.msk_id << ".\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeXidValue(renderExtension -> data.composite.src_id,
- clientCache -> renderSrcPictureCache);
-
- cachedRenderExtension -> data.composite.src_id =
- renderExtension -> data.composite.src_id;
-
- encodeBuffer.encodeXidValue(renderExtension -> data.composite.msk_id,
- clientCache -> renderSrcPictureCache);
-
- cachedRenderExtension -> data.composite.msk_id =
- renderExtension -> data.composite.msk_id;
-
- encodeBuffer.encodeXidValue(renderExtension -> data.composite.dst_id,
- clientCache -> renderSrcPictureCache);
-
- cachedRenderExtension -> data.composite.dst_id =
- renderExtension -> data.composite.dst_id;
-
- #ifdef TEST
- *logofs << name() << ": Encoded update. Type is "
- << (unsigned int) renderExtension -> data.composite.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_UPDATE
-
-MESSAGE_BEGIN_DECODE_UPDATE
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- decodeBuffer.decodeXidValue(renderExtension -> data.composite.src_id,
- clientCache -> renderSrcPictureCache);
-
- decodeBuffer.decodeXidValue(renderExtension -> data.composite.msk_id,
- clientCache -> renderSrcPictureCache);
-
- decodeBuffer.decodeXidValue(renderExtension -> data.composite.dst_id,
- clientCache -> renderSrcPictureCache);
-
- #ifdef TEST
- *logofs << name() << ": Decoded update. Type is "
- << (unsigned int) renderExtension -> data.composite.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_UPDATE
diff --git a/nxcomp/RenderCompositeCompat.h b/nxcomp/RenderCompositeCompat.h
deleted file mode 100644
index a26db35ba..000000000
--- a/nxcomp/RenderCompositeCompat.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef RenderCompositeCompat_H
-#define RenderCompositeCompat_H
-
-//
-// Define the characteristics
-// of this message class here.
-//
-
-#undef MESSAGE_NAME
-#define MESSAGE_NAME "RenderCompositeCompat"
-
-#undef MESSAGE_STORE
-#define MESSAGE_STORE RenderCompositeCompatStore
-
-#undef MESSAGE_CLASS
-#define MESSAGE_CLASS RenderMinorExtensionStore
-
-#undef MESSAGE_METHODS
-#define MESSAGE_METHODS "RenderMinorExtensionMethods.h"
-
-#undef MESSAGE_HEADERS
-#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h"
-
-#undef MESSAGE_TAGS
-#define MESSAGE_TAGS "RenderMinorExtensionTags.h"
-
-#undef MESSAGE_OFFSET
-#define MESSAGE_OFFSET 24
-
-#undef MESSAGE_HAS_SIZE
-#define MESSAGE_HAS_SIZE 1
-
-#undef MESSAGE_HAS_DATA
-#define MESSAGE_HAS_DATA 1
-
-#undef MESSAGE_HAS_FILTER
-#define MESSAGE_HAS_FILTER 0
-
-//
-// Declare the message class.
-//
-
-#include MESSAGE_HEADERS
-
-class MESSAGE_STORE : public MESSAGE_CLASS
-{
- public:
-
- virtual const char *name() const
- {
- return MESSAGE_NAME;
- }
-
- virtual int identitySize(const unsigned char *buffer,
- unsigned int size)
- {
- return MESSAGE_OFFSET;
- }
-
- #include MESSAGE_METHODS
-};
-
-#endif /* RenderCompositeCompat_H */
diff --git a/nxcomp/RenderCompositeGlyphsCompat.cpp b/nxcomp/RenderCompositeGlyphsCompat.cpp
deleted file mode 100644
index 3fe10fafb..000000000
--- a/nxcomp/RenderCompositeGlyphsCompat.cpp
+++ /dev/null
@@ -1,602 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-//
-// Include the template for
-// this message class.
-//
-
-#include "RenderCompositeGlyphsCompat.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-
-#include MESSAGE_TAGS
-
-//
-// Message handling methods.
-//
-
-MESSAGE_BEGIN_ENCODE_SIZE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- //
- // The offset points 8 bytes after
- // the beginning of the data part.
- //
-
- #ifdef DEBUG
- *logofs << name() << ": Encoding value "
- << ((size - (MESSAGE_OFFSET - 8)) >> 2)
- << ".\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeCachedValue((size - (MESSAGE_OFFSET - 8)) >> 2, 16,
- clientCache -> renderLengthCache, 5);
-
- #ifdef TEST
- *logofs << name() << ": Encoded size with value "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_SIZE
-
-MESSAGE_BEGIN_DECODE_SIZE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- decodeBuffer.decodeCachedValue(size, 16,
- clientCache -> renderLengthCache, 5);
-
- #ifdef DEBUG
- *logofs << name() << ": Decoded value " << size
- << ".\n" << logofs_flush;
- #endif
-
- size = (MESSAGE_OFFSET - 8) + (size << 2);
-
- buffer = writeBuffer -> addMessage(size);
-
- #ifdef TEST
- *logofs << name() << ": Decoded size with value "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_SIZE
-
-MESSAGE_BEGIN_ENCODE_MESSAGE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeCachedValue(*(buffer + 4), 8,
- clientCache -> renderOpCache);
-
- encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian),
- clientCache -> renderSrcPictureCache);
-
- encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian),
- clientCache -> renderSrcPictureCache);
-
- encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32,
- clientCache -> renderFormatCache);
-
- encodeBuffer.encodeCachedValue(GetULONG(buffer + 20, bigEndian), 29,
- clientCache -> renderGlyphSetCache);
-
- encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 24, bigEndian),
- clientCache -> renderLastX, 16,
- clientCache -> renderXCache, 11);
-
- encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 26, bigEndian),
- clientCache -> renderLastY, 16,
- clientCache -> renderYCache, 11);
-
- //
- // Try to save as many bits as possible by
- // encoding the information about the first
- // set of glyphs.
- //
-
- if (size >= MESSAGE_OFFSET)
- {
- unsigned int numGlyphs = *(buffer + 28);
-
- encodeBuffer.encodeCachedValue(numGlyphs, 8,
- clientCache -> renderNumGlyphsCache);
-
- encodeBuffer.encodeCachedValue(GetUINT(buffer + 32, bigEndian), 16,
- clientCache -> renderWidthCache, 11);
-
- encodeBuffer.encodeCachedValue(GetUINT(buffer + 34, bigEndian), 16,
- clientCache -> renderHeightCache, 11);
-
- //
- // Only manage the first set of glyphs,
- // that is in most cases the only one.
- //
-
- switch (*(buffer + 1))
- {
- case X_RenderCompositeGlyphs8:
- {
- if (numGlyphs & 0x03)
- {
- memset((unsigned char *) buffer + MESSAGE_OFFSET + numGlyphs, '\0',
- RoundUp4(numGlyphs) - numGlyphs);
- }
-
- break;
- }
- case X_RenderCompositeGlyphs16:
- {
- if (numGlyphs & 0x01)
- {
- memset((unsigned char *) buffer + MESSAGE_OFFSET + (numGlyphs * 2), '\0',
- RoundUp4(numGlyphs * 2) - numGlyphs * 2);
- }
-
- break;
- }
- }
-
- #ifdef TEST
- if (*(buffer + (size - 1)) != '\0')
- {
- *logofs << name() << ": WARNING! Final byte is non-zero with size "
- << size << " and " << (unsigned int) *(buffer + 28)
- << " glyphs.\n" << logofs_flush;
- }
- else
- {
- *logofs << name() << ": Final byte is zero with size "
- << size << " and " << (unsigned int) *(buffer + 28)
- << " glyphs.\n" << logofs_flush;
- }
- #endif
- }
-
- #ifdef TEST
- *logofs << name() << ": Encoded message. Type is "
- << (unsigned int) *(buffer + 1) << " size is "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_MESSAGE
-
-MESSAGE_BEGIN_DECODE_MESSAGE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- *(buffer + 1) = type;
-
- decodeBuffer.decodeCachedValue(*(buffer + 4), 8,
- clientCache -> renderOpCache);
-
- decodeBuffer.decodeXidValue(value,
- clientCache -> renderSrcPictureCache);
-
- PutULONG(value, buffer + 8, bigEndian);
-
- decodeBuffer.decodeXidValue(value,
- clientCache -> renderSrcPictureCache);
-
- PutULONG(value, buffer + 12, bigEndian);
-
- decodeBuffer.decodeCachedValue(value, 32,
- clientCache -> renderFormatCache);
-
- PutULONG(value, buffer + 16, bigEndian);
-
- decodeBuffer.decodeCachedValue(value, 29,
- clientCache -> renderGlyphSetCache);
-
- PutULONG(value, buffer + 20, bigEndian);
-
- decodeBuffer.decodeDiffCachedValue(value,
- clientCache -> renderLastX, 16,
- clientCache -> renderXCache, 11);
-
- PutUINT(clientCache -> renderLastX, buffer + 24, bigEndian);
-
- decodeBuffer.decodeDiffCachedValue(value,
- clientCache -> renderLastY, 16,
- clientCache -> renderYCache, 11);
-
- PutUINT(clientCache -> renderLastY, buffer + 26, bigEndian);
-
- if (size >= MESSAGE_OFFSET)
- {
- decodeBuffer.decodeCachedValue(value, 8,
- clientCache -> renderNumGlyphsCache);
-
- *(buffer + 28) = value;
-
- decodeBuffer.decodeCachedValue(value, 16,
- clientCache -> renderWidthCache, 11);
-
- PutUINT(value, buffer + 32, bigEndian);
-
- decodeBuffer.decodeCachedValue(value, 16,
- clientCache -> renderHeightCache, 11);
-
- PutUINT(value, buffer + 34, bigEndian);
- }
-
- #ifdef TEST
- *logofs << name() << ": Decoded message. Type is "
- << (unsigned int) type << " size is " << size
- << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_MESSAGE
-
-MESSAGE_BEGIN_ENCODE_DATA
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- switch (*(buffer + 1))
- {
- case X_RenderCompositeGlyphs8:
- {
- clientCache -> renderTextCompressor.reset();
-
- const unsigned char *next = buffer + MESSAGE_OFFSET;
-
- for (unsigned int i = MESSAGE_OFFSET; i < size; i++)
- {
- #ifdef DEBUG
- *logofs << name() << ": Encoding char with i = " << i
- << ".\n" << logofs_flush;
- #endif
-
- clientCache -> renderTextCompressor.
- encodeChar(*next++, encodeBuffer);
- }
-
- break;
- }
- case X_RenderCompositeGlyphs16:
- {
- for (unsigned int i = MESSAGE_OFFSET; i < size; i += 2)
- {
- value = GetUINT(buffer + i, bigEndian);
-
- #ifdef DEBUG
- *logofs << name() << ": Encoding short with i = " << i
- << ".\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeCachedValue(value, 16,
- *clientCache -> renderCompositeGlyphsDataCache[clientCache ->
- renderLastCompositeGlyphsData]);
-
- clientCache -> renderLastCompositeGlyphsData = value % 16;
- }
-
- break;
- }
- default:
- {
- for (unsigned int i = MESSAGE_OFFSET; i < size; i += 4)
- {
- value = GetULONG(buffer + i, bigEndian);
-
- #ifdef DEBUG
- *logofs << name() << ": Encoding long with i = " << i
- << ".\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeCachedValue(value, 32,
- *clientCache -> renderCompositeGlyphsDataCache[clientCache ->
- renderLastCompositeGlyphsData]);
-
- clientCache -> renderLastCompositeGlyphsData = value % 16;
- }
-
- break;
- }
- }
-
- #ifdef TEST
- *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET
- << " bytes of data.\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_DATA
-
-MESSAGE_BEGIN_DECODE_DATA
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- switch (*(buffer + 1))
- {
- case X_RenderCompositeGlyphs8:
- {
- clientCache -> renderTextCompressor.reset();
-
- unsigned char *next = buffer + MESSAGE_OFFSET;
-
- for (unsigned int i = MESSAGE_OFFSET; i < size; i++)
- {
- #ifdef DEBUG
- *logofs << name() << ": Decoding char with i = " << i
- << ".\n" << logofs_flush;
- #endif
-
- *next++ = clientCache -> renderTextCompressor.
- decodeChar(decodeBuffer);
- }
-
- break;
- }
- case X_RenderCompositeGlyphs16:
- {
- for (unsigned int i = MESSAGE_OFFSET; i < size; i += 2)
- {
- #ifdef DEBUG
- *logofs << name() << ": Decoding short with i = " << i
- << ".\n" << logofs_flush;
- #endif
-
- decodeBuffer.decodeCachedValue(value, 16,
- *clientCache -> renderCompositeGlyphsDataCache[clientCache ->
- renderLastCompositeGlyphsData]);
-
- PutUINT(value, buffer + i, bigEndian);
-
- clientCache -> renderLastCompositeGlyphsData = value % 16;
- }
-
- break;
- }
- default:
- {
- for (unsigned int i = MESSAGE_OFFSET; i < size; i += 4)
- {
- #ifdef DEBUG
- *logofs << name() << ": Decoding long with i = " << i
- << ".\n" << logofs_flush;
- #endif
-
- decodeBuffer.decodeCachedValue(value, 32,
- *clientCache -> renderCompositeGlyphsDataCache[clientCache ->
- renderLastCompositeGlyphsData]);
-
- PutULONG(value, buffer + i, bigEndian);
-
- clientCache -> renderLastCompositeGlyphsData = value % 16;
- }
-
- break;
- }
- }
-
- #ifdef TEST
- *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET
- << " bytes of data.\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_DATA
-
-MESSAGE_BEGIN_PARSE_IDENTITY
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- renderExtension -> data.composite_glyphs_compat.type = *(buffer + 1);
- renderExtension -> data.composite_glyphs_compat.op = *(buffer + 4);
-
- renderExtension -> data.composite_glyphs_compat.src_id = GetULONG(buffer + 8, bigEndian);
- renderExtension -> data.composite_glyphs_compat.dst_id = GetULONG(buffer + 12, bigEndian);
-
- renderExtension -> data.composite_glyphs_compat.format = GetULONG(buffer + 16, bigEndian);
- renderExtension -> data.composite_glyphs_compat.set_id = GetULONG(buffer + 20, bigEndian);
-
- renderExtension -> data.composite_glyphs_compat.src_x = GetUINT(buffer + 24, bigEndian);
- renderExtension -> data.composite_glyphs_compat.src_y = GetUINT(buffer + 26, bigEndian);
-
- if (size >= MESSAGE_OFFSET)
- {
- renderExtension -> data.composite_glyphs_compat.num_elm = *(buffer + 28);
-
- renderExtension -> data.composite_glyphs_compat.delta_x = GetUINT(buffer + 32, bigEndian);
- renderExtension -> data.composite_glyphs_compat.delta_y = GetUINT(buffer + 34, bigEndian);
- }
-
- #ifdef TEST
- *logofs << name() << ": Parsed identity. Type is "
- << (unsigned int) renderExtension -> data.composite_glyphs_compat.type
- << " size is " << renderExtension -> size_ << " identity size "
- << renderExtension -> i_size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_PARSE_IDENTITY
-
-MESSAGE_BEGIN_UNPARSE_IDENTITY
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- *(buffer + 1) = renderExtension -> data.composite_glyphs_compat.type;
- *(buffer + 4) = renderExtension -> data.composite_glyphs_compat.op;
-
- PutULONG(renderExtension -> data.composite_glyphs_compat.src_id, buffer + 8, bigEndian);
- PutULONG(renderExtension -> data.composite_glyphs_compat.dst_id, buffer + 12, bigEndian);
-
- PutULONG(renderExtension -> data.composite_glyphs_compat.format, buffer + 16, bigEndian);
- PutULONG(renderExtension -> data.composite_glyphs_compat.set_id, buffer + 20, bigEndian);
-
- PutUINT(renderExtension -> data.composite_glyphs_compat.src_x, buffer + 24, bigEndian);
- PutUINT(renderExtension -> data.composite_glyphs_compat.src_y, buffer + 26, bigEndian);
-
- if (size >= MESSAGE_OFFSET)
- {
- *(buffer + 28) = renderExtension -> data.composite_glyphs_compat.num_elm;
-
- PutUINT(renderExtension -> data.composite_glyphs_compat.delta_x, buffer + 32, bigEndian);
- PutUINT(renderExtension -> data.composite_glyphs_compat.delta_y, buffer + 34, bigEndian);
-
- #ifdef DEBUG
- *logofs << name() << ": Len is " << (unsigned int) *(buffer + 28)
- << " delta X is " << GetUINT(buffer + 32, bigEndian)
- << " delta Y is " << GetUINT(buffer + 34, bigEndian)
- << ".\n" << logofs_flush;
-
- *logofs << name() << ": Pad 1 is " << (unsigned int) *(buffer + 29)
- << " pad 2 and 3 are " << GetUINT(buffer + 30, bigEndian)
- << ".\n" << logofs_flush;
- #endif
- }
-
- #ifdef TEST
- *logofs << name() << ": Unparsed identity. Type is "
- << (unsigned int) renderExtension -> data.composite_glyphs_compat.type
- << " size is " << renderExtension -> size_ << " identity size "
- << renderExtension -> i_size_ << ".\n" << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_UNPARSE_IDENTITY
-
-MESSAGE_BEGIN_IDENTITY_CHECKSUM
-{
- //
- // Include minor opcode, size and
- // the composite operator in the
- // identity.
- //
-
- md5_append(md5_state, buffer + 1, 4);
-
- //
- // Include the format and the source
- // x and y fields.
- //
-
- md5_append(md5_state, buffer + 16, 4);
- md5_append(md5_state, buffer + 24, 4);
-
- //
- // Include the number of glyphs.
- //
-
- if (size >= MESSAGE_OFFSET)
- {
- md5_append(md5_state, buffer + 28, 1);
- }
-}
-MESSAGE_END_IDENTITY_CHECKSUM
-
-MESSAGE_BEGIN_ENCODE_UPDATE
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
- RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeXidValue(renderExtension -> data.composite_glyphs_compat.src_id,
- clientCache -> renderSrcPictureCache);
-
- cachedRenderExtension -> data.composite_glyphs_compat.src_id =
- renderExtension -> data.composite_glyphs_compat.src_id;
-
- encodeBuffer.encodeXidValue(renderExtension -> data.composite_glyphs_compat.dst_id,
- clientCache -> renderSrcPictureCache);
-
- cachedRenderExtension -> data.composite_glyphs_compat.dst_id =
- renderExtension -> data.composite_glyphs_compat.dst_id;
-
- encodeBuffer.encodeCachedValue(renderExtension -> data.composite_glyphs_compat.set_id, 29,
- clientCache -> renderGlyphSetCache);
-
- cachedRenderExtension -> data.composite_glyphs_compat.set_id =
- renderExtension -> data.composite_glyphs_compat.set_id;
-
- if (renderExtension -> size_ >= MESSAGE_OFFSET)
- {
- encodeBuffer.encodeCachedValue(renderExtension -> data.composite_glyphs_compat.delta_x, 16,
- clientCache -> renderWidthCache, 11);
-
- cachedRenderExtension -> data.composite_glyphs_compat.delta_x =
- renderExtension -> data.composite_glyphs_compat.delta_x;
-
- encodeBuffer.encodeCachedValue(renderExtension -> data.composite_glyphs_compat.delta_y, 16,
- clientCache -> renderHeightCache, 11);
-
- cachedRenderExtension -> data.composite_glyphs_compat.delta_y =
- renderExtension -> data.composite_glyphs_compat.delta_y;
- }
-
- #ifdef TEST
- *logofs << name() << ": Encoded update. Type is "
- << (unsigned int) renderExtension -> data.composite_glyphs_compat.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_UPDATE
-
-MESSAGE_BEGIN_DECODE_UPDATE
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- decodeBuffer.decodeXidValue(renderExtension -> data.composite_glyphs_compat.src_id,
- clientCache -> renderSrcPictureCache);
-
- decodeBuffer.decodeXidValue(renderExtension -> data.composite_glyphs_compat.dst_id,
- clientCache -> renderSrcPictureCache);
-
- decodeBuffer.decodeCachedValue(renderExtension -> data.composite_glyphs_compat.set_id, 29,
- clientCache -> renderGlyphSetCache);
-
- if (renderExtension -> size_ >= MESSAGE_OFFSET)
- {
- unsigned int value;
-
- decodeBuffer.decodeCachedValue(value, 16,
- clientCache -> renderWidthCache, 11);
-
- renderExtension -> data.composite_glyphs_compat.delta_x = value;
-
- decodeBuffer.decodeCachedValue(value, 16,
- clientCache -> renderHeightCache, 11);
-
- renderExtension -> data.composite_glyphs_compat.delta_y = value;
- }
-
- #ifdef TEST
- *logofs << name() << ": Decoded update. Type is "
- << (unsigned int) renderExtension -> data.composite_glyphs_compat.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_UPDATE
diff --git a/nxcomp/RenderCompositeGlyphsCompat.h b/nxcomp/RenderCompositeGlyphsCompat.h
deleted file mode 100644
index 7a00608c2..000000000
--- a/nxcomp/RenderCompositeGlyphsCompat.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef RenderCompositeGlyphsCompat_H
-#define RenderCompositeGlyphsCompat_H
-
-//
-// Define the characteristics
-// of this message class here.
-//
-
-#undef MESSAGE_NAME
-#define MESSAGE_NAME "RenderCompositeGlyphsCompat"
-
-#undef MESSAGE_STORE
-#define MESSAGE_STORE RenderCompositeGlyphsCompatStore
-
-#undef MESSAGE_CLASS
-#define MESSAGE_CLASS RenderMinorExtensionStore
-
-#undef MESSAGE_METHODS
-#define MESSAGE_METHODS "RenderMinorExtensionMethods.h"
-
-#undef MESSAGE_HEADERS
-#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h"
-
-#undef MESSAGE_TAGS
-#define MESSAGE_TAGS "RenderMinorExtensionTags.h"
-
-#undef MESSAGE_OFFSET
-#define MESSAGE_OFFSET 36
-
-#undef MESSAGE_HAS_SIZE
-#define MESSAGE_HAS_SIZE 1
-
-#undef MESSAGE_HAS_DATA
-#define MESSAGE_HAS_DATA 1
-
-#undef MESSAGE_HAS_FILTER
-#define MESSAGE_HAS_FILTER 0
-
-//
-// Declare the message class.
-//
-
-#include MESSAGE_HEADERS
-
-class MESSAGE_STORE : public MESSAGE_CLASS
-{
- public:
-
- virtual const char *name() const
- {
- return MESSAGE_NAME;
- }
-
- virtual int identitySize(const unsigned char *buffer,
- unsigned int size)
- {
- return (size >= MESSAGE_OFFSET ? MESSAGE_OFFSET : size);
- }
-
- #include MESSAGE_METHODS
-};
-
-#endif /* RenderCompositeGlyphsCompat_H */
diff --git a/nxcomp/RenderCreateGlyphSetCompat.cpp b/nxcomp/RenderCreateGlyphSetCompat.cpp
deleted file mode 100644
index 49e9f741d..000000000
--- a/nxcomp/RenderCreateGlyphSetCompat.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-//
-// Include the template for
-// this message class.
-//
-
-#include "RenderCreateGlyphSetCompat.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-
-#include MESSAGE_TAGS
-
-//
-// Message handling methods.
-//
-
-MESSAGE_BEGIN_ENCODE_SIZE
-{
- //
- // Strictly speaking this request doesn't have
- // a data part. We encode the fields past the
- // offset as they were data. An improvement
- // would be to encode the format field using
- // the cache.
- //
-
- #ifdef TEST
- *logofs << name() << ": Encoded size with value "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_SIZE
-
-MESSAGE_BEGIN_DECODE_SIZE
-{
- size = MESSAGE_OFFSET + 4;
-
- buffer = writeBuffer -> addMessage(size);
-
- #ifdef TEST
- *logofs << name() << ": Decoded size with value "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_SIZE
-
-MESSAGE_BEGIN_ENCODE_MESSAGE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeDiffCachedValue(GetULONG(buffer + 4, bigEndian),
- clientCache -> renderLastId, 29,
- clientCache -> renderIdCache);
-
- #ifdef TEST
- *logofs << name() << ": Encoded message. Type is "
- << (unsigned int) *(buffer + 1) << " size is "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_MESSAGE
-
-MESSAGE_BEGIN_DECODE_MESSAGE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- *(buffer + 1) = type;
-
- decodeBuffer.decodeDiffCachedValue(value,
- clientCache -> renderLastId, 29,
- clientCache -> renderIdCache);
-
- PutULONG(value, buffer + 4, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Decoded message. Type is "
- << (unsigned int) type << " size is " << size
- << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_MESSAGE
-
-MESSAGE_BEGIN_ENCODE_DATA
-{
- #ifdef DEBUG
-
- *logofs << name() << ": Glyphset is " << GetULONG(buffer + 4, bigEndian)
- << ".\n" << logofs_flush;
-
- if (size > MESSAGE_OFFSET)
- {
- *logofs << name() << ": Format is " << GetULONG(buffer + 8, bigEndian)
- << ".\n" << logofs_flush;
- }
-
- if (size > MESSAGE_OFFSET + 4)
- {
- *logofs << name() << ": WARNING! Unexpected size " << size
- << ".\n" << logofs_flush;
- }
-
- #endif
-
- encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET,
- size, bigEndian, channelCache);
-
- #ifdef TEST
- *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET
- << " bytes of data.\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_DATA
-
-MESSAGE_BEGIN_DECODE_DATA
-{
- decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET,
- size, bigEndian, channelCache);
-
- #ifdef TEST
- *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET
- << " bytes of data.\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_DATA
-
-MESSAGE_BEGIN_PARSE_IDENTITY
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- renderExtension -> data.create_set.type = *(buffer + 1);
-
- renderExtension -> data.create_set.set_id = GetULONG(buffer + 4, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Parsed identity. Type is "
- << (unsigned int) renderExtension -> data.create_set.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_PARSE_IDENTITY
-
-MESSAGE_BEGIN_UNPARSE_IDENTITY
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- *(buffer + 1) = renderExtension -> data.create_set.type;
-
- PutULONG(renderExtension -> data.create_set.set_id, buffer + 4, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Unparsed identity. Type is "
- << (unsigned int) renderExtension -> data.create_set.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_UNPARSE_IDENTITY
-
-MESSAGE_BEGIN_IDENTITY_CHECKSUM
-{
- md5_append(md5_state, buffer + 1, 3);
-}
-MESSAGE_END_IDENTITY_CHECKSUM
-
-MESSAGE_BEGIN_ENCODE_UPDATE
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
- RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeDiffCachedValue(renderExtension -> data.create_set.set_id,
- clientCache -> renderLastId, 29,
- clientCache -> renderIdCache);
-
- cachedRenderExtension -> data.create_set.set_id =
- renderExtension -> data.create_set.set_id;
-
- #ifdef TEST
- *logofs << name() << ": Encoded update. Type is "
- << (unsigned int) renderExtension -> data.create_set.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_UPDATE
-
-MESSAGE_BEGIN_DECODE_UPDATE
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- decodeBuffer.decodeDiffCachedValue(renderExtension -> data.create_set.set_id,
- clientCache -> renderLastId, 29,
- clientCache -> renderIdCache);
-
- #ifdef TEST
- *logofs << name() << ": Decoded update. Type is "
- << (unsigned int) renderExtension -> data.create_set.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_UPDATE
diff --git a/nxcomp/RenderCreateGlyphSetCompat.h b/nxcomp/RenderCreateGlyphSetCompat.h
deleted file mode 100644
index 174313e10..000000000
--- a/nxcomp/RenderCreateGlyphSetCompat.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef RenderCreateGlyphSetCompat_H
-#define RenderCreateGlyphSetCompat_H
-
-//
-// Define the characteristics
-// of this message class here.
-//
-
-#undef MESSAGE_NAME
-#define MESSAGE_NAME "RenderCreateGlyphSetCompat"
-
-#undef MESSAGE_STORE
-#define MESSAGE_STORE RenderCreateGlyphSetCompatStore
-
-#undef MESSAGE_CLASS
-#define MESSAGE_CLASS RenderMinorExtensionStore
-
-#undef MESSAGE_METHODS
-#define MESSAGE_METHODS "RenderMinorExtensionMethods.h"
-
-#undef MESSAGE_HEADERS
-#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h"
-
-#undef MESSAGE_TAGS
-#define MESSAGE_TAGS "RenderMinorExtensionTags.h"
-
-#undef MESSAGE_OFFSET
-#define MESSAGE_OFFSET 8
-
-#undef MESSAGE_HAS_SIZE
-#define MESSAGE_HAS_SIZE 1
-
-#undef MESSAGE_HAS_DATA
-#define MESSAGE_HAS_DATA 1
-
-#undef MESSAGE_HAS_FILTER
-#define MESSAGE_HAS_FILTER 0
-
-//
-// Declare the message class.
-//
-
-#include MESSAGE_HEADERS
-
-class MESSAGE_STORE : public MESSAGE_CLASS
-{
- public:
-
- virtual const char *name() const
- {
- return MESSAGE_NAME;
- }
-
- virtual int identitySize(const unsigned char *buffer,
- unsigned int size)
- {
- return MESSAGE_OFFSET;
- }
-
- #include MESSAGE_METHODS
-};
-
-#endif /* RenderCreateGlyphSetCompat_H */
diff --git a/nxcomp/RenderCreatePictureCompat.cpp b/nxcomp/RenderCreatePictureCompat.cpp
deleted file mode 100644
index fa4dcb400..000000000
--- a/nxcomp/RenderCreatePictureCompat.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-//
-// Include the template for
-// this message class.
-//
-
-#include "RenderCreatePictureCompat.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-
-#include MESSAGE_TAGS
-
-//
-// Message handling methods.
-//
-
-MESSAGE_BEGIN_ENCODE_SIZE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16,
- clientCache -> renderLengthCache, 5);
-
- #ifdef TEST
- *logofs << name() << ": Encoded size with value "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_SIZE
-
-MESSAGE_BEGIN_DECODE_SIZE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- decodeBuffer.decodeCachedValue(size, 16,
- clientCache -> renderLengthCache, 5);
-
- size = MESSAGE_OFFSET + (size << 2);
-
- buffer = writeBuffer -> addMessage(size);
-
- #ifdef TEST
- *logofs << name() << ": Decoded size with value "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_SIZE
-
-MESSAGE_BEGIN_ENCODE_MESSAGE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeDiffCachedValue(GetULONG(buffer + 4, bigEndian),
- clientCache -> renderLastId, 29,
- clientCache -> renderIdCache);
-
- encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian),
- clientCache -> drawableCache);
-
- encodeBuffer.encodeCachedValue(GetULONG(buffer + 12, bigEndian), 32,
- clientCache -> renderFormatCache);
-
- encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32,
- clientCache -> renderValueMaskCache);
-
- #ifdef TEST
- *logofs << name() << ": Encoded message. Type is "
- << (unsigned int) *(buffer + 1) << " size is "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_MESSAGE
-
-MESSAGE_BEGIN_DECODE_MESSAGE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- *(buffer + 1) = type;
-
- decodeBuffer.decodeDiffCachedValue(value,
- clientCache -> renderLastId, 29,
- clientCache -> renderIdCache);
-
- PutULONG(value, buffer + 4, bigEndian);
-
- decodeBuffer.decodeXidValue(value,
- clientCache -> drawableCache);
-
- PutULONG(value, buffer + 8, bigEndian);
-
- decodeBuffer.decodeCachedValue(value, 32,
- clientCache -> renderFormatCache);
-
- PutULONG(value, buffer + 12, bigEndian);
-
- decodeBuffer.decodeCachedValue(value, 32,
- clientCache -> renderValueMaskCache);
-
- PutULONG(value, buffer + 16, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Decoded message. Type is "
- << (unsigned int) type << " size is " << size
- << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_MESSAGE
-
-MESSAGE_BEGIN_ENCODE_DATA
-{
- encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET,
- size, bigEndian, channelCache);
-
- #ifdef TEST
- *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET
- << " bytes of data.\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_DATA
-
-MESSAGE_BEGIN_DECODE_DATA
-{
- decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET,
- size, bigEndian, channelCache);
-
- #ifdef TEST
- *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET
- << " bytes of data.\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_DATA
-
-MESSAGE_BEGIN_PARSE_IDENTITY
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- renderExtension -> data.create_picture.type = *(buffer + 1);
-
- renderExtension -> data.create_picture.src_id = GetULONG(buffer + 4, bigEndian);
- renderExtension -> data.create_picture.dst_id = GetULONG(buffer + 8, bigEndian);
-
- renderExtension -> data.create_picture.format = GetULONG(buffer + 12, bigEndian);
- renderExtension -> data.create_picture.mask = GetULONG(buffer + 16, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Parsed identity. Type is "
- << (unsigned int) renderExtension -> data.create_picture.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_PARSE_IDENTITY
-
-MESSAGE_BEGIN_UNPARSE_IDENTITY
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- *(buffer + 1) = renderExtension -> data.create_picture.type;
-
- PutULONG(renderExtension -> data.create_picture.src_id, buffer + 4, bigEndian);
- PutULONG(renderExtension -> data.create_picture.dst_id, buffer + 8, bigEndian);
-
- PutULONG(renderExtension -> data.create_picture.format, buffer + 12, bigEndian);
- PutULONG(renderExtension -> data.create_picture.mask, buffer + 16, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Unparsed identity. Type is "
- << (unsigned int) renderExtension -> data.create_picture.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_UNPARSE_IDENTITY
-
-MESSAGE_BEGIN_IDENTITY_CHECKSUM
-{
- md5_append(md5_state, buffer + 1, 3);
- md5_append(md5_state, buffer + 12, 8);
-}
-MESSAGE_END_IDENTITY_CHECKSUM
-
-MESSAGE_BEGIN_ENCODE_UPDATE
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
- RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- #ifdef DEBUG
- *logofs << name() << ": Encoding new id value "
- << renderExtension -> data.create_picture.src_id -
- clientCache -> renderLastId << ".\n";
- #endif
-
- encodeBuffer.encodeDiffCachedValue(renderExtension -> data.create_picture.src_id,
- clientCache -> renderLastId, 29,
- clientCache -> renderIdCache);
-
- cachedRenderExtension -> data.create_picture.src_id =
- renderExtension -> data.create_picture.src_id;
-
- encodeBuffer.encodeXidValue(renderExtension -> data.create_picture.dst_id,
- clientCache -> drawableCache);
-
- cachedRenderExtension -> data.create_picture.dst_id =
- renderExtension -> data.create_picture.dst_id;
-
- #ifdef TEST
- *logofs << name() << ": Encoded update. Type is "
- << (unsigned int) renderExtension -> data.create_picture.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_UPDATE
-
-MESSAGE_BEGIN_DECODE_UPDATE
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- decodeBuffer.decodeDiffCachedValue(renderExtension -> data.create_picture.src_id,
- clientCache -> renderLastId, 29,
- clientCache -> renderIdCache);
-
- decodeBuffer.decodeXidValue(renderExtension -> data.create_picture.dst_id,
- clientCache -> drawableCache);
-
- #ifdef TEST
- *logofs << name() << ": Decoded update. Type is "
- << (unsigned int) renderExtension -> data.create_picture.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_UPDATE
diff --git a/nxcomp/RenderCreatePictureCompat.h b/nxcomp/RenderCreatePictureCompat.h
deleted file mode 100644
index 15c8c85b3..000000000
--- a/nxcomp/RenderCreatePictureCompat.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef RenderCreatePictureCompat_H
-#define RenderCreatePictureCompat_H
-
-//
-// Define the characteristics
-// of this message class here.
-//
-
-#undef MESSAGE_NAME
-#define MESSAGE_NAME "RenderCreatePictureCompat"
-
-#undef MESSAGE_STORE
-#define MESSAGE_STORE RenderCreatePictureCompatStore
-
-#undef MESSAGE_CLASS
-#define MESSAGE_CLASS RenderMinorExtensionStore
-
-#undef MESSAGE_METHODS
-#define MESSAGE_METHODS "RenderMinorExtensionMethods.h"
-
-#undef MESSAGE_HEADERS
-#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h"
-
-#undef MESSAGE_TAGS
-#define MESSAGE_TAGS "RenderMinorExtensionTags.h"
-
-#undef MESSAGE_OFFSET
-#define MESSAGE_OFFSET 20
-
-#undef MESSAGE_HAS_SIZE
-#define MESSAGE_HAS_SIZE 1
-
-#undef MESSAGE_HAS_DATA
-#define MESSAGE_HAS_DATA 1
-
-#undef MESSAGE_HAS_FILTER
-#define MESSAGE_HAS_FILTER 0
-
-//
-// Declare the message class.
-//
-
-#include MESSAGE_HEADERS
-
-class MESSAGE_STORE : public MESSAGE_CLASS
-{
- public:
-
- virtual const char *name() const
- {
- return MESSAGE_NAME;
- }
-
- virtual int identitySize(const unsigned char *buffer,
- unsigned int size)
- {
- return MESSAGE_OFFSET;
- }
-
- #include MESSAGE_METHODS
-};
-
-#endif /* RenderCreatePictureCompat_H */
diff --git a/nxcomp/RenderFreePictureCompat.cpp b/nxcomp/RenderFreePictureCompat.cpp
deleted file mode 100644
index fb4c7ac54..000000000
--- a/nxcomp/RenderFreePictureCompat.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-//
-// Include the template for
-// this message class.
-//
-
-#include "RenderFreePictureCompat.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-
-#include MESSAGE_TAGS
-
-//
-// Message handling methods.
-//
-
-MESSAGE_BEGIN_ENCODE_MESSAGE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeDiffCachedValue(GetULONG(buffer + 4, bigEndian),
- clientCache -> renderLastId, 29,
- clientCache -> renderIdCache);
-
- #ifdef TEST
- *logofs << name() << ": Encoded message. Type is "
- << (unsigned int) *(buffer + 1) << " size is "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_MESSAGE
-
-MESSAGE_BEGIN_DECODE_MESSAGE
-{
- unsigned int value;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- *(buffer + 1) = type;
-
- decodeBuffer.decodeDiffCachedValue(value,
- clientCache -> renderLastId, 29,
- clientCache -> renderIdCache);
-
- PutULONG(value, buffer + 4, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Decoded message. Type is "
- << (unsigned int) type << " size is " << size
- << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_MESSAGE
-
-MESSAGE_BEGIN_PARSE_IDENTITY
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- renderExtension -> data.free_picture.type = *(buffer + 1);
-
- renderExtension -> data.free_picture.src_id = GetULONG(buffer + 4, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Parsed identity. Type is "
- << (unsigned int) renderExtension -> data.free_picture.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_PARSE_IDENTITY
-
-MESSAGE_BEGIN_UNPARSE_IDENTITY
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- *(buffer + 1) = renderExtension -> data.free_picture.type;
-
- PutULONG(renderExtension -> data.free_picture.src_id, buffer + 4, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Unparsed identity. Type is "
- << (unsigned int) renderExtension -> data.free_picture.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_UNPARSE_IDENTITY
-
-MESSAGE_BEGIN_IDENTITY_CHECKSUM
-{
- md5_append(md5_state, buffer + 1, 3);
-}
-MESSAGE_END_IDENTITY_CHECKSUM
-
-MESSAGE_BEGIN_ENCODE_UPDATE
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
- RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeDiffCachedValue(renderExtension -> data.free_picture.src_id,
- clientCache -> renderLastId, 29,
- clientCache -> renderIdCache);
-
- cachedRenderExtension -> data.free_picture.src_id =
- renderExtension -> data.free_picture.src_id;
-
- #ifdef TEST
- *logofs << name() << ": Encoded update. Type is "
- << (unsigned int) renderExtension -> data.free_picture.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_UPDATE
-
-MESSAGE_BEGIN_DECODE_UPDATE
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- decodeBuffer.decodeDiffCachedValue(renderExtension -> data.free_picture.src_id,
- clientCache -> renderLastId, 29,
- clientCache -> renderIdCache);
-
- #ifdef TEST
- *logofs << name() << ": Decoded update. Type is "
- << (unsigned int) renderExtension -> data.free_picture.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_UPDATE
diff --git a/nxcomp/RenderFreePictureCompat.h b/nxcomp/RenderFreePictureCompat.h
deleted file mode 100644
index 32d613ae0..000000000
--- a/nxcomp/RenderFreePictureCompat.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef RenderFreePictureCompat_H
-#define RenderFreePictureCompat_H
-
-//
-// Define the characteristics
-// of this message class here.
-//
-
-#undef MESSAGE_NAME
-#define MESSAGE_NAME "RenderFreePictureCompat"
-
-#undef MESSAGE_STORE
-#define MESSAGE_STORE RenderFreePictureCompatStore
-
-#undef MESSAGE_CLASS
-#define MESSAGE_CLASS RenderMinorExtensionStore
-
-#undef MESSAGE_METHODS
-#define MESSAGE_METHODS "RenderMinorExtensionMethods.h"
-
-#undef MESSAGE_HEADERS
-#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h"
-
-#undef MESSAGE_TAGS
-#define MESSAGE_TAGS "RenderMinorExtensionTags.h"
-
-#undef MESSAGE_OFFSET
-#define MESSAGE_OFFSET 8
-
-#undef MESSAGE_HAS_SIZE
-#define MESSAGE_HAS_SIZE 0
-
-#undef MESSAGE_HAS_DATA
-#define MESSAGE_HAS_DATA 0
-
-#undef MESSAGE_HAS_FILTER
-#define MESSAGE_HAS_FILTER 0
-
-//
-// Declare the message class.
-//
-
-#include MESSAGE_HEADERS
-
-class MESSAGE_STORE : public MESSAGE_CLASS
-{
- public:
-
- virtual const char *name() const
- {
- return MESSAGE_NAME;
- }
-
- virtual int identitySize(const unsigned char *buffer,
- unsigned int size)
- {
- return MESSAGE_OFFSET;
- }
-
- #include MESSAGE_METHODS
-};
-
-#endif /* RenderFreePictureCompat_H */
diff --git a/nxcomp/RenderPictureClipCompat.cpp b/nxcomp/RenderPictureClipCompat.cpp
deleted file mode 100644
index 67d873008..000000000
--- a/nxcomp/RenderPictureClipCompat.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-//
-// Include the template for
-// this message class.
-//
-
-#include "RenderPictureClipCompat.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-
-#include MESSAGE_TAGS
-
-//
-// Message handling methods.
-//
-
-MESSAGE_BEGIN_ENCODE_SIZE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16,
- clientCache -> renderLengthCache, 5);
-
- #ifdef TEST
- *logofs << name() << ": Encoded size with value "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_SIZE
-
-MESSAGE_BEGIN_DECODE_SIZE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- decodeBuffer.decodeCachedValue(size, 16,
- clientCache -> renderLengthCache, 5);
-
- size = MESSAGE_OFFSET + (size << 2);
-
- buffer = writeBuffer -> addMessage(size);
-
- #ifdef TEST
- *logofs << name() << ": Decoded size with value "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_SIZE
-
-MESSAGE_BEGIN_ENCODE_MESSAGE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian),
- clientCache -> renderSrcPictureCache);
-
- encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 8, bigEndian),
- clientCache -> renderLastX, 16,
- clientCache -> renderXCache, 11);
-
- encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 10, bigEndian),
- clientCache -> renderLastY, 16,
- clientCache -> renderYCache, 11);
-
- #ifdef TEST
- *logofs << name() << ": Encoded message. Type is "
- << (unsigned int) *(buffer + 1) << " size is "
- << size << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_MESSAGE
-
-MESSAGE_BEGIN_DECODE_MESSAGE
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- *(buffer + 1) = type;
-
- decodeBuffer.decodeXidValue(value,
- clientCache -> renderSrcPictureCache);
-
- PutULONG(value, buffer + 4, bigEndian);
-
- decodeBuffer.decodeDiffCachedValue(value,
- clientCache -> renderLastX, 16,
- clientCache -> renderXCache, 11);
-
- PutUINT(clientCache -> renderLastX, buffer + 8, bigEndian);
-
- decodeBuffer.decodeDiffCachedValue(value,
- clientCache -> renderLastY, 16,
- clientCache -> renderYCache, 11);
-
- PutUINT(clientCache -> renderLastY, buffer + 10, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Decoded message. Type is "
- << (unsigned int) type << " size is " << size
- << ".\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_MESSAGE
-
-MESSAGE_BEGIN_ENCODE_DATA
-{
- encodeIntData(encodeBuffer, buffer, MESSAGE_OFFSET,
- size, bigEndian, channelCache);
-
- #ifdef TEST
- *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET
- << " bytes of data.\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_DATA
-
-MESSAGE_BEGIN_DECODE_DATA
-{
- decodeIntData(decodeBuffer, buffer, MESSAGE_OFFSET,
- size, bigEndian, channelCache);
-
- #ifdef TEST
- *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET
- << " bytes of data.\n" << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_DATA
-
-MESSAGE_BEGIN_PARSE_IDENTITY
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- renderExtension -> data.picture_clip.type = *(buffer + 1);
-
- renderExtension -> data.picture_clip.src_id = GetULONG(buffer + 4, bigEndian);
-
- renderExtension -> data.picture_clip.src_x = GetUINT(buffer + 8, bigEndian);
- renderExtension -> data.picture_clip.src_y = GetUINT(buffer + 10, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Parsed identity. Type is "
- << (unsigned int) renderExtension -> data.picture_clip.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_PARSE_IDENTITY
-
-MESSAGE_BEGIN_UNPARSE_IDENTITY
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- *(buffer + 1) = renderExtension -> data.picture_clip.type;
-
- PutULONG(renderExtension -> data.picture_clip.src_id, buffer + 4, bigEndian);
-
- PutUINT(renderExtension -> data.picture_clip.src_x, buffer + 8, bigEndian);
- PutUINT(renderExtension -> data.picture_clip.src_y, buffer + 10, bigEndian);
-
- #ifdef TEST
- *logofs << name() << ": Unparsed identity. Type is "
- << (unsigned int) renderExtension -> data.picture_clip.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_UNPARSE_IDENTITY
-
-MESSAGE_BEGIN_IDENTITY_CHECKSUM
-{
- md5_append(md5_state, buffer + 1, 3);
- md5_append(md5_state, buffer + 8, 4);
-}
-MESSAGE_END_IDENTITY_CHECKSUM
-
-MESSAGE_BEGIN_ENCODE_UPDATE
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
- RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeXidValue(renderExtension -> data.picture_clip.src_id,
- clientCache -> renderSrcPictureCache);
-
- cachedRenderExtension -> data.picture_clip.src_id =
- renderExtension -> data.picture_clip.src_id;
-
- #ifdef TEST
- *logofs << name() << ": Encoded update. Type is "
- << (unsigned int) renderExtension -> data.picture_clip.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_ENCODE_UPDATE
-
-MESSAGE_BEGIN_DECODE_UPDATE
-{
- RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- decodeBuffer.decodeXidValue(renderExtension -> data.picture_clip.src_id,
- clientCache -> renderSrcPictureCache);
-
- #ifdef TEST
- *logofs << name() << ": Decoded update. Type is "
- << (unsigned int) renderExtension -> data.picture_clip.type
- << " size is " << renderExtension -> size_ << ".\n"
- << logofs_flush;
- #endif
-}
-MESSAGE_END_DECODE_UPDATE
diff --git a/nxcomp/RenderPictureClipCompat.h b/nxcomp/RenderPictureClipCompat.h
deleted file mode 100644
index 05fc5cda8..000000000
--- a/nxcomp/RenderPictureClipCompat.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef RenderPictureClipCompat_H
-#define RenderPictureClipCompat_H
-
-//
-// Define the characteristics
-// of this message class here.
-//
-
-#undef MESSAGE_NAME
-#define MESSAGE_NAME "RenderPictureClipCompat"
-
-#undef MESSAGE_STORE
-#define MESSAGE_STORE RenderPictureClipCompatStore
-
-#undef MESSAGE_CLASS
-#define MESSAGE_CLASS RenderMinorExtensionStore
-
-#undef MESSAGE_METHODS
-#define MESSAGE_METHODS "RenderMinorExtensionMethods.h"
-
-#undef MESSAGE_HEADERS
-#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h"
-
-#undef MESSAGE_TAGS
-#define MESSAGE_TAGS "RenderMinorExtensionTags.h"
-
-#undef MESSAGE_OFFSET
-#define MESSAGE_OFFSET 12
-
-#undef MESSAGE_HAS_SIZE
-#define MESSAGE_HAS_SIZE 1
-
-#undef MESSAGE_HAS_DATA
-#define MESSAGE_HAS_DATA 1
-
-#undef MESSAGE_HAS_FILTER
-#define MESSAGE_HAS_FILTER 0
-
-//
-// Declare the message class.
-//
-
-#include MESSAGE_HEADERS
-
-class MESSAGE_STORE : public MESSAGE_CLASS
-{
- public:
-
- virtual const char *name() const
- {
- return MESSAGE_NAME;
- }
-
- virtual int identitySize(const unsigned char *buffer,
- unsigned int size)
- {
- return MESSAGE_OFFSET;
- }
-
- #include MESSAGE_METHODS
-};
-
-#endif /* RenderPictureClipCompat_H */
diff --git a/nxcomp/SetUnpackAlphaCompat.cpp b/nxcomp/SetUnpackAlphaCompat.cpp
deleted file mode 100644
index a8fcabdeb..000000000
--- a/nxcomp/SetUnpackAlphaCompat.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#include "SetUnpackAlphaCompat.h"
-
-#include "ClientCache.h"
-
-#include "EncodeBuffer.h"
-#include "DecodeBuffer.h"
-
-#include "WriteBuffer.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-#undef DUMP
-
-//
-// Constructors and destructors.
-//
-
-SetUnpackAlphaCompatStore::SetUnpackAlphaCompatStore(StaticCompressor *compressor)
-
- : MessageStore(compressor)
-{
- enableCache = SETUNPACKALPHA_ENABLE_CACHE;
- enableData = SETUNPACKALPHA_ENABLE_DATA;
- enableSplit = SETUNPACKALPHA_ENABLE_SPLIT;
- enableCompress = SETUNPACKALPHA_ENABLE_COMPRESS;
-
- dataLimit = SETUNPACKALPHA_DATA_LIMIT;
- dataOffset = SETUNPACKALPHA_DATA_OFFSET;
-
- cacheSlots = SETUNPACKALPHA_CACHE_SLOTS;
- cacheThreshold = SETUNPACKALPHA_CACHE_THRESHOLD;
- cacheLowerThreshold = SETUNPACKALPHA_CACHE_LOWER_THRESHOLD;
-
- messages_ -> resize(cacheSlots);
-
- for (T_messages::iterator i = messages_ -> begin();
- i < messages_ -> end(); i++)
- {
- *i = NULL;
- }
-
- temporary_ = NULL;
-}
-
-SetUnpackAlphaCompatStore::~SetUnpackAlphaCompatStore()
-{
- for (T_messages::iterator i = messages_ -> begin();
- i < messages_ -> end(); i++)
- {
- destroy(*i);
- }
-
- destroy(temporary_);
-}
-
-//
-// Here are the methods to handle messages' content.
-//
-
-int SetUnpackAlphaCompatStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer,
- const unsigned int size, int bigEndian,
- ChannelCache *channelCache) const
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- #ifdef DEBUG
- *logofs << name() << ": Encoding full message identity.\n" << logofs_flush;
- #endif
-
- // Client.
- encodeBuffer.encodeCachedValue(*(buffer + 1), 8,
- clientCache -> resourceCache);
- // Entries.
- encodeBuffer.encodeValue(GetULONG(buffer + 4, bigEndian), 32, 9);
-
- #ifdef DEBUG
- *logofs << name() << ": Encoded full message identity.\n" << logofs_flush;
- #endif
-
- return 1;
-}
-
-int SetUnpackAlphaCompatStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer,
- unsigned int &size, int bigEndian, WriteBuffer *writeBuffer,
- ChannelCache *channelCache) const
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- #ifdef DEBUG
- *logofs << name() << ": Decoding full message identity.\n" << logofs_flush;
- #endif
-
- unsigned int value;
- unsigned char cValue;
-
- // Client.
- decodeBuffer.decodeCachedValue(cValue, 8,
- clientCache -> resourceCache);
- // Entries.
- decodeBuffer.decodeValue(value, 32, 9);
-
- size = RoundUp4(value) + 8;
-
- buffer = writeBuffer -> addMessage(size);
-
- *(buffer + 1) = cValue;
-
- PutULONG(value, buffer + 4, bigEndian);
-
- #ifdef DEBUG
- *logofs << name() << ": Decoded full message identity.\n" << logofs_flush;
- #endif
-
- return 1;
-}
-
-int SetUnpackAlphaCompatStore::parseIdentity(Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const
-{
- SetUnpackAlphaCompatMessage *setUnpackAlpha = (SetUnpackAlphaCompatMessage *) message;
-
- setUnpackAlpha -> client = *(buffer + 1);
-
- setUnpackAlpha -> entries = GetULONG(buffer + 4, bigEndian);
-
- #ifdef DEBUG
- *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush;
- #endif
-
- return 1;
-}
-
-int SetUnpackAlphaCompatStore::unparseIdentity(const Message *message, unsigned char *buffer,
- unsigned int size, int bigEndian) const
-{
- SetUnpackAlphaCompatMessage *setUnpackAlpha = (SetUnpackAlphaCompatMessage *) message;
-
- *(buffer + 1) = setUnpackAlpha -> client;
-
- PutULONG(setUnpackAlpha -> entries, buffer + 4, bigEndian);
-
- #ifdef DEBUG
- *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush;
- #endif
-
- return 1;
-}
-
-void SetUnpackAlphaCompatStore::dumpIdentity(const Message *message) const
-{
- #ifdef DUMP
-
- SetUnpackAlphaCompatMessage *setUnpackAlpha = (SetUnpackAlphaCompatMessage *) message;
-
- *logofs << name() << ": Identity client "
- << (unsigned int) setUnpackAlpha -> client << " entries "
- << setUnpackAlpha -> entries << " size "
- << setUnpackAlpha -> size_ << ".\n";
-
- #endif
-}
-
-void SetUnpackAlphaCompatStore::identityChecksum(const Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const
-{
- md5_append(md5_state_, buffer + 4, 4);
-}
-
-void SetUnpackAlphaCompatStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message,
- const Message *cachedMessage,
- ChannelCache *channelCache) const
-{
- SetUnpackAlphaCompatMessage *setUnpackAlpha = (SetUnpackAlphaCompatMessage *) message;
- SetUnpackAlphaCompatMessage *cachedSetUnpackAlpha = (SetUnpackAlphaCompatMessage *) cachedMessage;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- encodeBuffer.encodeCachedValue(setUnpackAlpha -> client, 8,
- clientCache -> resourceCache);
-
- cachedSetUnpackAlpha -> client = setUnpackAlpha -> client;
-
- if (cachedSetUnpackAlpha -> entries != setUnpackAlpha -> entries)
- {
- #ifdef TEST
- *logofs << name() << ": Encoding value " << setUnpackAlpha -> entries
- << " as entries field.\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeBoolValue(1);
-
- encodeBuffer.encodeValue(setUnpackAlpha -> entries, 32, 9);
-
- cachedSetUnpackAlpha -> entries = setUnpackAlpha -> entries;
- }
- else
- {
- encodeBuffer.encodeBoolValue(0);
- }
-}
-
-void SetUnpackAlphaCompatStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message,
- ChannelCache *channelCache) const
-{
- SetUnpackAlphaCompatMessage *setUnpackAlpha = (SetUnpackAlphaCompatMessage *) message;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- decodeBuffer.decodeCachedValue(setUnpackAlpha -> client, 8,
- clientCache -> resourceCache);
-
- decodeBuffer.decodeBoolValue(value);
-
- if (value)
- {
- decodeBuffer.decodeValue(value, 32, 9);
-
- setUnpackAlpha -> entries = value;
-
- #ifdef DEBUG
- *logofs << name() << ": Decoded value " << setUnpackAlpha -> entries
- << " as entries field.\n" << logofs_flush;
- #endif
- }
-}
diff --git a/nxcomp/SetUnpackAlphaCompat.h b/nxcomp/SetUnpackAlphaCompat.h
deleted file mode 100644
index 80d1522c0..000000000
--- a/nxcomp/SetUnpackAlphaCompat.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef SetUnpackAlphaCompat_H
-#define SetUnpackAlphaCompat_H
-
-#include "Message.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-#undef DUMP
-
-//
-// Set default values.
-//
-
-#define SETUNPACKALPHA_ENABLE_CACHE 1
-#define SETUNPACKALPHA_ENABLE_DATA 1
-#define SETUNPACKALPHA_ENABLE_SPLIT 0
-#define SETUNPACKALPHA_ENABLE_COMPRESS 1
-
-#define SETUNPACKALPHA_DATA_LIMIT 16384
-#define SETUNPACKALPHA_DATA_OFFSET 8
-
-#define SETUNPACKALPHA_CACHE_SLOTS 2000
-#define SETUNPACKALPHA_CACHE_THRESHOLD 10
-#define SETUNPACKALPHA_CACHE_LOWER_THRESHOLD 5
-
-//
-// The message class.
-//
-
-class SetUnpackAlphaCompatMessage : public Message
-{
- friend class SetUnpackAlphaCompatStore;
-
- public:
-
- SetUnpackAlphaCompatMessage()
- {
- }
-
- ~SetUnpackAlphaCompatMessage()
- {
- }
-
- //
- // Put here the fields which constitute
- // the 'identity' part of the message.
- //
-
- private:
-
- unsigned char client;
- unsigned int entries;
-};
-
-class SetUnpackAlphaCompatStore : public MessageStore
-{
- public:
-
- SetUnpackAlphaCompatStore(StaticCompressor *compressor);
-
- virtual ~SetUnpackAlphaCompatStore();
-
- virtual const char *name() const
- {
- return "SetUnpackAlphaCompat";
- }
-
- virtual unsigned char opcode() const
- {
- return X_NXSetUnpackAlpha;
- }
-
- virtual unsigned int storage() const
- {
- return sizeof(SetUnpackAlphaCompatMessage);
- }
-
- //
- // Message handling methods.
- //
-
- protected:
-
- virtual Message *create() const
- {
- return new SetUnpackAlphaCompatMessage();
- }
-
- virtual Message *create(const Message &message) const
- {
- return new SetUnpackAlphaCompatMessage((const SetUnpackAlphaCompatMessage &) message);
- }
-
- virtual void destroy(Message *message) const
- {
- delete (SetUnpackAlphaCompatMessage *) message;
- }
-
- virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer,
- const unsigned int size, int bigEndian,
- ChannelCache *channelCache) const;
-
- virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer,
- unsigned int &size, int bigEndian, WriteBuffer *writeBuffer,
- ChannelCache *channelCache) const;
-
- virtual int parseIdentity(Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const;
-
- virtual int unparseIdentity(const Message *message, unsigned char *buffer,
- unsigned int size, int bigEndian) const;
-
- virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message,
- const Message *cachedMessage,
- ChannelCache *channelCache) const;
-
- virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message,
- ChannelCache *channelCache) const;
-
- virtual void identityChecksum(const Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const;
-
- virtual void dumpIdentity(const Message *message) const;
-};
-
-#endif /* SetUnpackAlphaCompat_H */
diff --git a/nxcomp/SetUnpackColormapCompat.cpp b/nxcomp/SetUnpackColormapCompat.cpp
deleted file mode 100644
index 65b108a82..000000000
--- a/nxcomp/SetUnpackColormapCompat.cpp
+++ /dev/null
@@ -1,262 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#include "SetUnpackColormapCompat.h"
-
-#include "ClientCache.h"
-
-#include "EncodeBuffer.h"
-#include "DecodeBuffer.h"
-
-#include "WriteBuffer.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-#undef DUMP
-
-//
-// Constructors and destructors.
-//
-
-SetUnpackColormapCompatStore::SetUnpackColormapCompatStore(StaticCompressor *compressor)
-
- : MessageStore(compressor)
-{
- enableCache = SETUNPACKCOLORMAP_ENABLE_CACHE;
- enableData = SETUNPACKCOLORMAP_ENABLE_DATA;
- enableSplit = SETUNPACKCOLORMAP_ENABLE_SPLIT;
- enableCompress = SETUNPACKCOLORMAP_ENABLE_COMPRESS;
-
- dataLimit = SETUNPACKCOLORMAP_DATA_LIMIT;
- dataOffset = SETUNPACKCOLORMAP_DATA_OFFSET;
-
- cacheSlots = SETUNPACKCOLORMAP_CACHE_SLOTS;
- cacheThreshold = SETUNPACKCOLORMAP_CACHE_THRESHOLD;
- cacheLowerThreshold = SETUNPACKCOLORMAP_CACHE_LOWER_THRESHOLD;
-
- messages_ -> resize(cacheSlots);
-
- for (T_messages::iterator i = messages_ -> begin();
- i < messages_ -> end(); i++)
- {
- *i = NULL;
- }
-
- temporary_ = NULL;
-}
-
-SetUnpackColormapCompatStore::~SetUnpackColormapCompatStore()
-{
- for (T_messages::iterator i = messages_ -> begin();
- i < messages_ -> end(); i++)
- {
- destroy(*i);
- }
-
- destroy(temporary_);
-}
-
-//
-// Here are the methods to handle messages' content.
-//
-
-int SetUnpackColormapCompatStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer,
- const unsigned int size, int bigEndian,
- ChannelCache *channelCache) const
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- #ifdef DEBUG
- *logofs << name() << ": Encoding full message identity.\n" << logofs_flush;
- #endif
-
- // Client.
- encodeBuffer.encodeCachedValue(*(buffer + 1), 8,
- clientCache -> resourceCache);
- // Entries.
- encodeBuffer.encodeValue(GetULONG(buffer + 4, bigEndian), 32, 9);
-
- #ifdef DEBUG
- *logofs << name() << ": Encoded full message identity.\n" << logofs_flush;
- #endif
-
- return 1;
-}
-
-int SetUnpackColormapCompatStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer,
- unsigned int &size, int bigEndian, WriteBuffer *writeBuffer,
- ChannelCache *channelCache) const
-{
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- #ifdef DEBUG
- *logofs << name() << ": Decoding full message identity.\n" << logofs_flush;
- #endif
-
- unsigned int value;
- unsigned char cValue;
-
- // Client.
- decodeBuffer.decodeCachedValue(cValue, 8,
- clientCache -> resourceCache);
- // Entries.
- decodeBuffer.decodeValue(value, 32, 9);
-
- size = (value << 2) + 8;
-
- buffer = writeBuffer -> addMessage(size);
-
- *(buffer + 1) = cValue;
-
- PutULONG(value, buffer + 4, bigEndian);
-
- #ifdef DEBUG
- *logofs << name() << ": Decoded full message identity.\n" << logofs_flush;
- #endif
-
- return 1;
-}
-
-int SetUnpackColormapCompatStore::parseIdentity(Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const
-{
- SetUnpackColormapCompatMessage *setUnpackColormap = (SetUnpackColormapCompatMessage *) message;
-
- setUnpackColormap -> client = *(buffer + 1);
-
- setUnpackColormap -> entries = GetULONG(buffer + 4, bigEndian);
-
- #ifdef DEBUG
- *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush;
- #endif
-
- return 1;
-}
-
-int SetUnpackColormapCompatStore::unparseIdentity(const Message *message, unsigned char *buffer,
- unsigned int size, int bigEndian) const
-{
- SetUnpackColormapCompatMessage *setUnpackColormap = (SetUnpackColormapCompatMessage *) message;
-
- *(buffer + 1) = setUnpackColormap -> client;
-
- PutULONG(setUnpackColormap -> entries, buffer + 4, bigEndian);
-
- #ifdef DEBUG
- *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush;
- #endif
-
- return 1;
-}
-
-void SetUnpackColormapCompatStore::dumpIdentity(const Message *message) const
-{
- #ifdef DUMP
-
- SetUnpackColormapCompatMessage *setUnpackColormap = (SetUnpackColormapCompatMessage *) message;
-
- *logofs << name() << ": Identity client "
- << (unsigned int) setUnpackColormap -> client << " entries "
- << setUnpackColormap -> entries << " size "
- << setUnpackColormap -> size_ << ".\n";
-
- #endif
-}
-
-void SetUnpackColormapCompatStore::identityChecksum(const Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const
-{
- md5_append(md5_state_, buffer + 4, 4);
-}
-
-void SetUnpackColormapCompatStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message,
- const Message *cachedMessage,
- ChannelCache *channelCache) const
-{
- SetUnpackColormapCompatMessage *setUnpackColormap = (SetUnpackColormapCompatMessage *) message;
- SetUnpackColormapCompatMessage *cachedSetUnpackColormap = (SetUnpackColormapCompatMessage *) cachedMessage;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- #ifdef TEST
- *logofs << name() << ": Encoding value "
- << (unsigned int) setUnpackColormap -> client
- << " as client field.\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeCachedValue(setUnpackColormap -> client, 8,
- clientCache -> resourceCache);
-
- cachedSetUnpackColormap -> client = setUnpackColormap -> client;
-
- if (cachedSetUnpackColormap -> entries != setUnpackColormap -> entries)
- {
- #ifdef TEST
- *logofs << name() << ": Encoding value " << setUnpackColormap -> entries
- << " as entries field.\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeBoolValue(1);
-
- encodeBuffer.encodeValue(setUnpackColormap -> entries, 32, 9);
-
- cachedSetUnpackColormap -> entries = setUnpackColormap -> entries;
- }
- else
- {
- encodeBuffer.encodeBoolValue(0);
- }
-}
-
-void SetUnpackColormapCompatStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message,
- ChannelCache *channelCache) const
-{
- SetUnpackColormapCompatMessage *setUnpackColormap = (SetUnpackColormapCompatMessage *) message;
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- decodeBuffer.decodeCachedValue(setUnpackColormap -> client, 8,
- clientCache -> resourceCache);
-
- #ifdef DEBUG
- *logofs << name() << ": Decoded value "
- << (unsigned int) setUnpackColormap -> client
- << " as client field.\n" << logofs_flush;
- #endif
-
- decodeBuffer.decodeBoolValue(value);
-
- if (value)
- {
- decodeBuffer.decodeValue(value, 32, 9);
-
- setUnpackColormap -> entries = value;
-
- #ifdef DEBUG
- *logofs << name() << ": Decoded value " << setUnpackColormap -> entries
- << " as entries field.\n" << logofs_flush;
- #endif
- }
-}
diff --git a/nxcomp/SetUnpackColormapCompat.h b/nxcomp/SetUnpackColormapCompat.h
deleted file mode 100644
index d1ffad876..000000000
--- a/nxcomp/SetUnpackColormapCompat.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef SetUnpackColormapCompat_H
-#define SetUnpackColormapCompat_H
-
-#include "Message.h"
-
-//
-// Set the verbosity level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-#undef DUMP
-
-//
-// Set default values.
-//
-
-#define SETUNPACKCOLORMAP_ENABLE_CACHE 1
-#define SETUNPACKCOLORMAP_ENABLE_DATA 1
-#define SETUNPACKCOLORMAP_ENABLE_SPLIT 1
-#define SETUNPACKCOLORMAP_ENABLE_COMPRESS 1
-
-#define SETUNPACKCOLORMAP_DATA_LIMIT 4096
-#define SETUNPACKCOLORMAP_DATA_OFFSET 8
-
-#define SETUNPACKCOLORMAP_CACHE_SLOTS 2000
-#define SETUNPACKCOLORMAP_CACHE_THRESHOLD 5
-#define SETUNPACKCOLORMAP_CACHE_LOWER_THRESHOLD 0
-
-//
-// The message class.
-//
-
-class SetUnpackColormapCompatMessage : public Message
-{
- friend class SetUnpackColormapCompatStore;
-
- public:
-
- SetUnpackColormapCompatMessage()
- {
- }
-
- ~SetUnpackColormapCompatMessage()
- {
- }
-
- //
- // Put here the fields which constitute
- // the 'identity' part of the message.
- //
-
- private:
-
- unsigned char client;
- unsigned int entries;
-};
-
-class SetUnpackColormapCompatStore : public MessageStore
-{
- public:
-
- SetUnpackColormapCompatStore(StaticCompressor *compressor);
-
- virtual ~SetUnpackColormapCompatStore();
-
- virtual const char *name() const
- {
- return "SetUnpackColormapCompat";
- }
-
- virtual unsigned char opcode() const
- {
- return X_NXSetUnpackColormap;
- }
-
- virtual unsigned int storage() const
- {
- return sizeof(SetUnpackColormapCompatMessage);
- }
-
- //
- // Message handling methods.
- //
-
- protected:
-
- virtual Message *create() const
- {
- return new SetUnpackColormapCompatMessage();
- }
-
- virtual Message *create(const Message &message) const
- {
- return new SetUnpackColormapCompatMessage((const SetUnpackColormapCompatMessage &) message);
- }
-
- virtual void destroy(Message *message) const
- {
- delete (SetUnpackColormapCompatMessage *) message;
- }
-
- virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer,
- const unsigned int size, int bigEndian,
- ChannelCache *channelCache) const;
-
- virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer,
- unsigned int &size, int bigEndian, WriteBuffer *writeBuffer,
- ChannelCache *channelCache) const;
-
- virtual int parseIdentity(Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const;
-
- virtual int unparseIdentity(const Message *message, unsigned char *buffer,
- unsigned int size, int bigEndian) const;
-
- virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message,
- const Message *cachedMessage,
- ChannelCache *channelCache) const;
-
- virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message,
- ChannelCache *channelCache) const;
-
- virtual void identityChecksum(const Message *message, const unsigned char *buffer,
- unsigned int size, int bigEndian) const;
-
- virtual void dumpIdentity(const Message *message) const;
-};
-
-#endif /* SetUnpackColormapCompat_H */
diff --git a/nxcomp/TextCompressor.cpp b/nxcomp/TextCompressor.cpp
deleted file mode 100644
index 16131222c..000000000
--- a/nxcomp/TextCompressor.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#include "TextCompressor.h"
-
-#include "EncodeBuffer.h"
-#include "DecodeBuffer.h"
-
-//
-// The compression obtained by this class is
-// very poor. In newer versions the text is
-// simply appended to the encode buffer and
-// compressed by leveraging the final stream
-// compression.
-//
-
-void
-TextCompressor::encodeChar(unsigned char ch, EncodeBuffer& encodeBuffer)
-{
- // encode each successive character of text using
- // a predictive model where most of the last 3 characters
- // (low order 7 bits of the previous character, plus the
- // low order 5 bits of the character before that, plus
- // the low order 3 bits of the character before that)
- // are used to find the right cache...
-
- CharCache& cache = cache_[key_ % cacheSize_];
- if ((key_ >= 128) && (cache.getSize() == 0))
- {
- // 3rd-order model doesn't have any statistics yet,
- // so use the 1st-order one instead
- CharCache& cache2 = cache_[(key_ & 0x7f) % cacheSize_];
- encodeBuffer.encodeCachedValue((unsigned int) ch, 8, cache2);
- cache.insert(ch);
- }
- else
- {
- encodeBuffer.encodeCachedValue((unsigned int) ch, 8, cache);
- }
-
- key_ = (((key_ & 0x1f) << 7) | ((key_ & 0x380) << 5) | (ch & 0x7f));
-}
-
-
-unsigned char
-TextCompressor::decodeChar(DecodeBuffer& decodeBuffer)
-{
- unsigned char nextChar;
- CharCache& cache = cache_[key_ % cacheSize_];
- if ((key_ >= 128) && (cache.getSize() == 0))
- {
- CharCache& cache2 = cache_[(key_ & 0x7f) % cacheSize_];
- decodeBuffer.decodeCachedValue(nextChar, 8, cache2);
- cache.insert(nextChar);
- }
- else
- {
- decodeBuffer.decodeCachedValue(nextChar, 8, cache);
- }
-
- key_ = (((key_ & 0x1f) << 7) | ((key_ & 0x380) << 5) | (nextChar & 0x7f));
- return nextChar;
-}
diff --git a/nxcomp/TextCompressor.h b/nxcomp/TextCompressor.h
deleted file mode 100644
index b373b98b8..000000000
--- a/nxcomp/TextCompressor.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#ifndef TextCompressor_H
-#define TextCompressor_H
-
-#include "CharCache.h"
-
-class EncodeBuffer;
-class DecodeBuffer;
-
-class TextCompressor
-{
- public:
- TextCompressor(CharCache* cache, unsigned int cacheSize):
- cache_(cache),
- cacheSize_(cacheSize),
- key_(0)
- {
- }
-
- void encodeChar(unsigned char ch, EncodeBuffer &);
- unsigned char decodeChar(DecodeBuffer &);
- void reset(unsigned int newKey = 0)
- {
- key_ = newKey;
- }
-
- private:
- CharCache* cache_;
- unsigned int cacheSize_;
- unsigned int key_;
-};
-
-#endif /* TextCompressor_H */
diff --git a/nxcomp/Utils.cpp b/nxcomp/Utils.cpp
deleted file mode 100644
index a2820782a..000000000
--- a/nxcomp/Utils.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#include "NX.h"
-
-#include "Timestamp.h"
-
-//
-// Log level.
-//
-
-#define PANIC
-#define WARNING
-#undef TEST
-#undef DEBUG
-
-int NXTransSearch(char *data, int size, int step, int threshold)
-{
- return -1;
-}
-
diff --git a/nxcomp/VERSION b/nxcomp/VERSION
index 1545d9665..6ff19de4b 100644..120000
--- a/nxcomp/VERSION
+++ b/nxcomp/VERSION
@@ -1 +1 @@
-3.5.0
+../VERSION \ No newline at end of file
diff --git a/nxcomp/XidCache.cpp b/nxcomp/XidCache.cpp
deleted file mode 100644
index a9a723c76..000000000
--- a/nxcomp/XidCache.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/**************************************************************************/
-/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
-/* */
-/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
-/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
-/* */
-/* All rights reserved. */
-/* */
-/**************************************************************************/
-
-#include "Control.h"
-
-#include "XidCache.h"
-
-XidCache::XidCache()
-{
- for (int i = 0; i < 256; i++)
- {
- base_[i] = new IntCache(8);
- }
-
- slot_ = 0;
- last_ = 0;
-}
-
-XidCache::~XidCache()
-{
- for (int i = 0; i < 256; i++)
- {
- delete base_[i];
- }
-}
diff --git a/nxcomp/configure.ac b/nxcomp/configure.ac
new file mode 100644
index 000000000..8037250e7
--- /dev/null
+++ b/nxcomp/configure.ac
@@ -0,0 +1,118 @@
+# ***************************************************************************
+# *** configure.ac for nxcomp ***
+# ***************************************************************************
+
+m4_define([nxcomp_version], m4_esyscmd([tr -d '\n' < VERSION]))
+
+# Initialize Autoconf
+AC_PREREQ(2.60)
+
+AC_INIT([libXcomp], [nxcomp_version], [https://github.com/ArcticaProject/nx-libs/issues])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_PROG_CXX
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+
+AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz])
+
+# Initialize libtool
+AC_PROG_LIBTOOL
+
+COMP_VERSION=nxcomp_version
+AC_SUBST([COMP_VERSION])
+
+LT_COMP_VERSION=[`echo $COMP_VERSION | sed -r -e 's/^([0-9]+\.[0-9]+\.[0-9]+).*$/\1/' -e 's/\./:/g'`]
+AC_SUBST([LT_COMP_VERSION])
+
+# Silence warning: ar: 'u' modifier ignored since 'D' is the default
+AC_SUBST(AR_FLAGS, [cr])
+
+# Upstream's pkg.m4 (since 0.27) offers this now, but define our own
+# compatible version in case the local version of pkgconfig isn't new enough.
+# https://bugs.freedesktop.org/show_bug.cgi?id=48743
+m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR],
+ [AC_ARG_WITH([pkgconfigdir],
+ [AS_HELP_STRING([--with-pkgconfigdir],
+ [install directory for nxcomp.pc pkg-config file])],
+ [],[with_pkgconfigdir='$(libdir)/pkgconfig'])
+ AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])])
+
+PKG_CHECK_MODULES([JPEG], [libjpeg], [], [LIBJPEG_FALLBACK_CHECK])
+PKG_CHECK_MODULES([PNG], [libpng])
+PKG_CHECK_MODULES([Z], [zlib])
+
+AC_LANG([C++])
+NX_COMPILER_BRAND
+NX_DEFAULT_OPTIONS
+
+NX_BUILD_ON_CYGWIN32
+NX_BUILD_ON_AMD64
+NX_BUILD_ON_DARWIN
+NX_BUILD_ON_SUN
+NX_BUILD_ON_FreeBSD
+
+# Build PIC libraries.
+
+if test "$CYGWIN32" != yes -a "$DARWIN" != yes; then
+ CXXFLAGS="$CXXFLAGS -fPIC"
+ CFLAGS="$CFLAGS -fPIC"
+fi
+
+# On FreeBSD search libraries and includes under /usr/local.
+
+if test "$FreeBSD" = yes; then
+ LIBS="$LIBS -L/usr/local/lib"
+ CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+fi
+
+AX_PTHREAD([], AC_MSG_ERROR([no POSIX threads support detected]))
+
+# If in_addr_t is not defined use unsigned int.
+AC_CHECK_TYPES([in_addr_t], [], [], [[#include <netinet/in.h>]])
+
+AC_ARG_ENABLE([cxx11],
+ [AS_HELP_STRING([--enable-cxx11],
+ [enable optional features requiring C++11 support (disabled by default)])],
+ [AS_IF([test x$enableval = xyes],
+ [AX_CXX_COMPILE_STDCXX_11([], [mandatory])])])
+
+# Check if std::put_time is available.
+AC_MSG_CHECKING([if std::put_time is available])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[[
+#include <iomanip>
+#include <ctime>
+]],
+[[
+std::time_t t = std::time(NULL);
+std::tm tm = *std::localtime(&t);
+(void) std::put_time(&tm, "%c");
+]])],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_STD_PUT_TIME, [1],
+ [Use std::put_time to format times, must be made available by the compiler if turned on.])],
+ [AC_MSG_RESULT([no])])
+
+AC_ARG_ENABLE([debug],
+ [AS_HELP_STRING([--enable-debug],
+ [enable to get info session log output (disabled by default)])],
+ [AS_IF([test x$enableval = xyes],
+ [AC_DEFINE(INFO, 1, [Define this to get info session log output.])
+ info_messages=yes])])
+
+AC_ARG_ENABLE([valgrind],
+ [AS_HELP_STRING([--enable-valgrind],
+ [enable for extra valgrind hacks (disabled by default)])],
+ [AS_IF([test x$enableval = xyes],
+ [AC_DEFINE(VALGRIND, 1, [Define this for extra valgrind hacks.])
+ valgrind_hacks=yes])])
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+test/Makefile
+nxcomp.pc
+])
+
+AC_OUTPUT
diff --git a/nxcomp/configure.in b/nxcomp/configure.in
deleted file mode 100644
index e9ab81da8..000000000
--- a/nxcomp/configure.in
+++ /dev/null
@@ -1,393 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-
-dnl Prolog
-
-AC_INIT(NX.h)
-AC_PREREQ(2.13)
-
-dnl Set our default compilation flags.
-
-CXXFLAGS="-O3 -fno-rtti -fno-exceptions"
-CFLAGS="-O3"
-
-dnl Reset default linking directives.
-
-LIBSTATIC=""
-LIBSHARED=""
-
-dnl Prefer headers and libraries from nx-X11, if present.
-
-if test -d "../nx-X11/include" ; then
- CXXFLAGS="$CXXFLAGS -I../nx-X11/exports/include"
- CFLAGS="$CFLAGS -I../nx-X11/exports/include"
- LIBS="$LIBS -L../nx-X11/exports/lib"
-fi
-
-dnl Check whether --with-ipaq was given.
-
-if test "${with_ipaq}" = yes; then
- echo -e "enabling IPAQ configuration"
- CXX="arm-linux-c++"
- CC="arm-linux-gcc"
- unset ac_cv_prog_armcxx
- unset ac_cv_prog_armcc
- unset ac_cv_prog_CXXCPP
- AC_CHECK_PROG([armcxx],["$CXX"],[yes],[no],[$PATH])
- AC_CHECK_PROG([armcc],["$CC"],[yes],[no],[$PATH])
- if test $armcxx = "yes" && test $armcc = "yes" ; then
- ac_cv_prog_CXX="$CXX"
- ac_cv_prog_CC="$CC"
- else
- AC_MSG_ERROR(Installation or configuration problem. Cannot find compiler for arm-linux.)
- fi
-else
- unset ac_cv_prog_CXX
- unset ac_cv_prog_CC
- unset ac_cv_prog_CXXCPP
-fi
-
-dnl Check for programs.
-
-AC_PROG_CXX
-AC_PROG_CC
-AC_LANG_CPLUSPLUS
-
-dnl Check whether option -Wno-deprecated
-dnl is needed by GCC compiler.
-
-AC_MSG_CHECKING([whether compiler needs -Wno-deprecated])
-gcc_version=`${CC} --version | grep 'gcc (GCC) [[3-4]].' | head -n 1`
-case "${gcc_version}" in
- gcc*)
- AC_MSG_RESULT([yes])
- CXXFLAGS="$CXXFLAGS -Wno-deprecated"
- ;;
-
- *)
- AC_MSG_RESULT([no])
- ;;
-esac
-
-AC_MSG_CHECKING([whether compiler accepts -Wmissing-declarations])
-gcc_version=`${CC} --version | grep 'gcc (GCC) [[3-4]].' | head -n 1`
-case "${gcc_version}" in
- gcc*)
- AC_MSG_RESULT([no])
- ;;
-
- *)
- AC_MSG_RESULT([yes])
- CXXFLAGS="$CXXFLAGS -Wmissing-declarations"
- ;;
-esac
-
-dnl Check for BSD compatible install.
-
-AC_PROG_INSTALL
-
-dnl Check for extra header files.
-
-AC_PATH_XTRA
-
-dnl Custom addition.
-
-ac_help="$ac_help
- --with-symbols add the -g flag to produce the debug symbols
- --with-use-malloc add the __USE_MALLOC flag to avoid the STL allocators
- --with-info define INFO at compile time to get basic log output
- --with-valgrind clean up allocated buffers to avoid valgrind warnings
- --with-version use this version for produced libraries
-
- --with-static-png enable static linking of PNG library
- --with-static-jpeg enable static linking of JPEG library
- --with-static-z enable static linking of Z library"
-
-dnl Check to see if we're running under Cygwin32.
-
-AC_DEFUN(nxconf_CYGWIN32,
-[AC_CACHE_CHECK(for Cygwin32 environment, nxconf_cv_cygwin32,
-[AC_TRY_COMPILE(,[return __CYGWIN32__;],
-nxconf_cv_cygwin32=yes, nxconf_cv_cygwin32=no)
-rm -f conftest*])
-CYGWIN32=
-test "$nxconf_cv_cygwin32" = yes && CYGWIN32=yes])
-nxconf_CYGWIN32
-
-dnl Check whether we're building on a AMD64.
-
-AC_DEFUN(nxconf_AMD64,
-[AC_CACHE_CHECK(for Amd64 environment, nxconf_cv_amd64,
-[AC_TRY_COMPILE(,[return (__amd64__ || __x86_64__);],
-nxconf_cv_amd64=yes, nxconf_cv_amd64=no)
-rm -f conftest*])
-AMD64=
-test "$nxconf_cv_amd64" = yes && AMD64=yes])
-nxconf_AMD64
-
-dnl Check for Darwin environment.
-
-AC_DEFUN(nxconf_DARWIN,
-[AC_CACHE_CHECK(for Darwin environment, nxconf_cv_darwin,
-[AC_TRY_COMPILE(,[return __APPLE__;],
-nxconf_cv_darwin=yes, nxconf_cv_darwin=no)
-rm -f conftest*])
-DARWIN=
-test "$nxconf_cv_darwin" = yes && DARWIN=yes])
-nxconf_DARWIN
-
-dnl Check to see if we're running under Solaris.
-
-AC_DEFUN(nxconf_SUN,
-[AC_CACHE_CHECK(for Solaris environment, nxconf_cv_sun,
-[AC_TRY_COMPILE(,[return __sun;],
-nxconf_cv_sun=yes, nxconf_cv_sun=no)
-rm -f conftest*])
-SUN=
-test "$nxconf_cv_sun" = yes && SUN=yes])
-nxconf_SUN
-
-dnl Check to see if we're running under FreeBSD.
-
-AC_DEFUN(nxconf_FreeBSD,
-[AC_CACHE_CHECK(for FreeBSD environment, nxconf_cv_freebsd,
-[AC_TRY_COMPILE(,[return __FreeBSD__;],
-nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no)
-rm -f conftest*])
-FreeBSD=
-test "$nxconf_cv_freebsd" = yes && FreeBSD=yes])
-nxconf_FreeBSD
-
-dnl Build PIC libraries.
-
-if test "$CYGWIN32" != yes -a "$DARWIN" != yes; then
- CXXFLAGS="$CXXFLAGS -fPIC"
- CFLAGS="$CFLAGS -fPIC"
-fi
-
-dnl Solaris requires the socket and gcc_s libs explicitly linked.
-dnl Note also that headers from default /usr/openwin/include/X11
-dnl cause a warning due to pragma in Xmd.h.
-
-if test "$SUN" = yes; then
- LIBS="$LIBS -L/usr/sfw/lib -lsocket "
- CXXFLAGS="$CXXFLAGS -I/usr/sfw/include"
- CFLAGS="$CFLAGS -I/usr/sfw/include"
-fi
-
-dnl On FreeBSD search libraries and includes under /usr/local.
-
-if test "$FreeBSD" = yes; then
- LIBS="$LIBS -L/usr/local/lib"
- CXXFLAGS="$CXXFLAGS -I/usr/local/include"
- CFLAGS="$CFLAGS -I/usr/local/include"
-fi
-
-dnl Under Darwin we don't have support for -soname option and
-dnl we need the -bundle flag. Under Solaris, instead, we need
-dnl the options -G -h.
-
-if test "$DARWIN" = yes; then
- LDFLAGS="$LDFLAGS -bundle"
-elif test "$SUN" = yes; then
- LDFLAGS="$LDFLAGS -G -h \$(LIBLOAD)"
-else
- LDFLAGS="$LDFLAGS -Wl,-soname,\$(LIBLOAD)"
-fi
-
-dnl Check to see if in_addr_t is defined.
-dnl Could use a specific configure test.
-
-AC_DEFUN(nxconf_INADDRT,
-[AC_CACHE_CHECK(for in_addr_t, nxconf_cv_inaddrt,
-[AC_TRY_COMPILE([#include <netinet/in.h>],[in_addr_t t; t = 1; return t;],
-nxconf_cv_inaddrt=yes, nxconf_cv_inaddrt=no)
-rm -f conftest*])
-INADDRT=
-test "$nxconf_cv_inaddrt" = yes && INADDRT=yes])
-nxconf_INADDRT
-
-dnl If in_addr_t is not defined use unsigned int.
-
-if test "$INADDRT" != yes ; then
- echo -e "using unsigned int for type in_addr_t"
- CXXFLAGS="$CXXFLAGS -DIN_ADDR_T=unsigned"
- CFLAGS="$CFLAGS -DIN_ADDR_T=unsigned"
-else
- CXXFLAGS="$CXXFLAGS -DIN_ADDR_T=in_addr_t"
- CFLAGS="$CFLAGS -DIN_ADDR_T=in_addr_t"
-fi
-
-dnl Check whether --with-version was given.
-
-AC_SUBST(LIBVERSION)
-AC_SUBST(VERSION)
-if test "${with_version}" = yes; then
- VERSION=${ac_option}
-else
- VERSION=`cat VERSION`
-fi
-echo -e "compiling version ${VERSION}"
-
-LIBVERSION=`echo ${VERSION} | cut -d '.' -f 1`
-
-CXXFLAGS="$CXXFLAGS -DVERSION=\\\"${VERSION}\\\""
-CFLAGS="$CFLAGS -DVERSION=\\\"${VERSION}\\\""
-
-dnl Check whether --with-static-png was given and
-dnl add -lpng or libpng.a to linking.
-
-if test "${with_static_png}" = yes; then
- echo -e "enabling static linking of PNG library"
- if test "$SUN" = yes && test -f "/usr/sfw/lib/libpng.a"; then
- LIBSTATIC="$LIBSTATIC /usr/sfw/lib/libpng.a"
- else
- if test -f "/usr/lib/libpng.a" ; then
- LIBSTATIC="$LIBSTATIC /usr/lib/libpng.a"
- else
- if test -f "/usr/local/lib/libpng.a" ; then
- echo -e "assuming libpng.a in /usr/local/lib"
- LIBSTATIC="$LIBSTATIC /usr/local/lib/libpng.a"
- else
- echo -e "Warning: assuming libpng.a in the local path"
- LIBSTATIC="$LIBSTATIC libpng.a"
- fi
- fi
- fi
-else
- echo -e "enabling dynamic linking of PNG library"
- LIBSHARED="$LIBSHARED -lpng"
-fi
-
-dnl Check whether --with-static-jpeg was given and
-dnl add -ljpeg or libjpeg.a to linking.
-
-if test "${with_static_jpeg}" = yes; then
- echo -e "enabling static linking of JPEG library"
- if test "$SUN" = yes && test -f "/usr/sfw/lib/libjpeg.a"; then
- LIBSTATIC="$LIBSTATIC /usr/sfw/lib/libjpeg.a"
- else
- if test -f "/usr/lib/libjpeg.a" ; then
- LIBSTATIC="$LIBSTATIC /usr/lib/libjpeg.a"
- else
- if test -f "/usr/local/lib/libjpeg.a" ; then
- echo -e "assuming libjpeg.a in /usr/local/lib"
- LIBSTATIC="$LIBSTATIC /usr/local/lib/libjpeg.a"
- else
- echo -e "Warning: assuming libjpeg.a in the local path"
- LIBSTATIC="$LIBSTATIC libjpeg.a"
- fi
- fi
- fi
-else
- echo -e "enabling dynamic linking of JPEG library"
- LIBSHARED="$LIBSHARED -ljpeg"
-fi
-
-dnl Check whether --with-static-z was given and
-dnl add -lz or libz.a to linking.
-
-if test "${with_static_z}" = yes; then
- echo -e "enabling static linking of Z library"
- if test "$SUN" = yes && test -f "/usr/sfw/lib/libz.a"; then
- LIBSTATIC="$LIBSTATIC /usr/sfw/lib/libz.a"
- else
- if test -f "/usr/lib/libz.a" ; then
- LIBSTATIC="$LIBSTATIC /usr/lib/libz.a"
- else
- if test -f "/usr/local/lib/libz.a" ; then
- echo -e "assuming libz.a in /usr/local/lib"
- LIBSTATIC="$LIBSTATIC /usr/local/lib/libz.a"
- else
- echo -e "Warning: assuming libz.a in the local path"
- LIBSTATIC="$LIBSTATIC libz.a"
- fi
- fi
- fi
-else
- echo -e "enabling dynamic linking of Z library"
- LIBSHARED="$LIBSHARED -lz"
-fi
-
-dnl Finally compose the LIB variable.
-
-if test "$DARWIN" = yes ; then
- LIBS="$LIBS $LIBSTATIC $LIBSHARED"
-elif test "$SUN" = yes ; then
- LIBS="$LIBS $LIBSTATIC $LIBSHARED"
-else
- LIBS="$LIBS $LIBSTATIC -shared $LIBSHARED"
-fi
-
-dnl Check whether --with-symbols or --without-symbols was
-dnl given and set the required optimization level.
-
-if test "${with_symbols}" = yes; then
- echo -e "enabling production of debug symbols"
- CXXFLAGS="-g $CXXFLAGS"
- CFLAGS="-g $CFLAGS"
-else
- echo -e "disabling production of debug symbols"
-fi
-
-dnl Check whether --with-use-malloc or --without-use-malloc
-dnl was given.
-
-if test "${with_use_malloc}" = yes; then
- echo -e "disabling use of the STL allocators"
- CXXFLAGS="$CXXFLAGS -D__USE_MALLOC"
-else
- echo -e "enabling use of the STL allocators"
-fi
-
-dnl Check whether --with-info or --without-info was given.
-
-if test "${with_info}" = yes; then
- echo -e "enabling info output in the log file"
- CXXFLAGS="$CXXFLAGS -DINFO"
- CFLAGS="$CFLAGS -DINFO"
-else
- echo -e "disabling info output in the log file"
-fi
-
-dnl Check whether --with-valgrind or --without-valgrind was given.
-
-if test "${with_valgrind}" = yes; then
- echo -e "enabling valgrind memory checker workarounds"
- CXXFLAGS="$CXXFLAGS -DVALGRIND"
- CFLAGS="$CFLAGS -DVALGRIND"
-else
- echo -e "disabling valgrind memory checker workarounds"
-fi
-
-dnl Find makedepend somewhere.
-
-AC_SUBST(MAKEDEPEND)
-
-if test -x "../nx-X11/config/makedepend/makedepend" ; then
- MAKEDEPEND=../nx-X11/config/makedepend/makedepend
-else
- if test -x "/usr/X11R6/bin/makedepend" ; then
- MAKEDEPEND=/usr/X11R6/bin/makedepend
- else
- if test -x "/usr/openwin/bin/makedepend" ; then
- MAKEDEPEND=/usr/openwin/bin/makedepend
- else
- MAKEDEPEND=/usr/bin/makedepend
- fi
- fi
-fi
-
-dnl Determine what to build based on the platform.
-dnl Override the LIBS settings on Cygwin32 so that
-dnl we always link with the exact set of libraries.
-
-AC_SUBST(ALL)
-
-if test "$CYGWIN32" = yes; then
- ALL="\$(LIBCYGARCHIVE) \$(LIBCYGSHARED) \$(LIBARCHIVE)"
- LIBS="-lstdc++ -lpng -ljpeg -lz"
-else
- ALL="\$(LIBFULL) \$(LIBLOAD) \$(LIBSHARED) \$(LIBARCHIVE)"
-fi
-
-AC_OUTPUT(Makefile)
diff --git a/nxcomp/MD5.h b/nxcomp/include/MD5.h
index 698c995d8..698c995d8 100644
--- a/nxcomp/MD5.h
+++ b/nxcomp/include/MD5.h
diff --git a/nxcomp/NX.h b/nxcomp/include/NX.h
index d98af79bb..7ec79b4b1 100644
--- a/nxcomp/NX.h
+++ b/nxcomp/include/NX.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef NX_H
@@ -442,6 +450,20 @@ extern int NXTransParseEnvironment(const char *env, int force);
extern void NXTransCleanup(void) __attribute__((noreturn));
+/*
+ * Cleans up the global and local state
+ * (the same way as NXTransCleanup does)
+ * but does not exit the process
+ * Needed for IOS platform
+ */
+extern void NXTransCleanupForReconnect(void);
+
+extern const char* NXVersion(void);
+extern int NXMajorVersion(void);
+extern int NXMinorVersion(void);
+extern int NXPatchVersion(void);
+extern int NXMaintenancePatchVersion(void);
+
#ifdef __cplusplus
}
#endif
diff --git a/nxcomp/NXalert.h b/nxcomp/include/NXalert.h
index 2f01a3071..dca2f44ca 100644
--- a/nxcomp/NXalert.h
+++ b/nxcomp/include/NXalert.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef NXalert_H
diff --git a/nxcomp/NXpack.h b/nxcomp/include/NXpack.h
index de1c0f0d9..3eade6855 100644
--- a/nxcomp/NXpack.h
+++ b/nxcomp/include/NXpack.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef NXpack_H
diff --git a/nxcomp/NXproto.h b/nxcomp/include/NXproto.h
index ce25cc4c7..7b988bdbf 100644
--- a/nxcomp/NXproto.h
+++ b/nxcomp/include/NXproto.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef NXproto_H
diff --git a/nxcomp/NXvars.h b/nxcomp/include/NXvars.h
index 3bee6d3ed..f514000d7 100644
--- a/nxcomp/NXvars.h
+++ b/nxcomp/include/NXvars.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef NXvars_H
diff --git a/nxcomp/install-sh b/nxcomp/install-sh
deleted file mode 100755
index 58719246f..000000000
--- a/nxcomp/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/nxcomp/m4/ax_cxx_compile_stdcxx.m4 b/nxcomp/m4/ax_cxx_compile_stdcxx.m4
new file mode 120000
index 000000000..28ebfd1a6
--- /dev/null
+++ b/nxcomp/m4/ax_cxx_compile_stdcxx.m4
@@ -0,0 +1 @@
+../../m4/ax_cxx_compile_stdcxx.m4 \ No newline at end of file
diff --git a/nxcomp/m4/ax_cxx_compile_stdcxx_11.m4 b/nxcomp/m4/ax_cxx_compile_stdcxx_11.m4
new file mode 120000
index 000000000..5fbe8790d
--- /dev/null
+++ b/nxcomp/m4/ax_cxx_compile_stdcxx_11.m4
@@ -0,0 +1 @@
+../../m4/ax_cxx_compile_stdcxx_11.m4 \ No newline at end of file
diff --git a/nxcomp/m4/ax_pthread.m4 b/nxcomp/m4/ax_pthread.m4
new file mode 120000
index 000000000..156af3df3
--- /dev/null
+++ b/nxcomp/m4/ax_pthread.m4
@@ -0,0 +1 @@
+../../m4/ax_pthread.m4 \ No newline at end of file
diff --git a/nxcomp/m4/nx-macros.m4 b/nxcomp/m4/nx-macros.m4
new file mode 120000
index 000000000..813e9b041
--- /dev/null
+++ b/nxcomp/m4/nx-macros.m4
@@ -0,0 +1 @@
+../../m4/nx-macros.m4 \ No newline at end of file
diff --git a/nxcomp/mkinstalldirs b/nxcomp/mkinstalldirs
deleted file mode 100755
index 936cf3407..000000000
--- a/nxcomp/mkinstalldirs
+++ /dev/null
@@ -1,34 +0,0 @@
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Last modified: 1995-03-05
-# Public domain
-
-errstatus=0
-
-for file in ${1+"$@"} ; do
- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
- shift
-
- pathcomp=
- for d in ${1+"$@"} ; do
- pathcomp="$pathcomp$d"
- case "$pathcomp" in
- -* ) pathcomp=./$pathcomp ;;
- esac
-
- if test ! -d "$pathcomp"; then
- echo "mkdir $pathcomp" 1>&2
- mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
- fi
-
- if test ! -d "$pathcomp"; then
- errstatus=$lasterr
- fi
-
- pathcomp="$pathcomp/"
- done
-done
-
-exit $errstatus
diff --git a/nxcomp/nxcomp.pc.in b/nxcomp/nxcomp.pc.in
new file mode 100644
index 000000000..26206d857
--- /dev/null
+++ b/nxcomp/nxcomp.pc.in
@@ -0,0 +1,15 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: nxcomp
+Description: NX Compression Library
+Version: @COMP_VERSION@
+#libjepg does not provide a pkgconfig-file, zlib does not provide it for older versions
+#Requires: libjpeg zlib
+Requires: libpng
+Requires.private: x11
+Cflags: -I${includedir}
+Libs: -L${libdir} -lXcomp
+
diff --git a/nxcomp/src/ActionCache.cpp b/nxcomp/src/ActionCache.cpp
new file mode 100644
index 000000000..783b1724e
--- /dev/null
+++ b/nxcomp/src/ActionCache.cpp
@@ -0,0 +1,51 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
+/* */
+/* NXCOMP, NX protocol compression and NX extensions to this software */
+/* are copyright of the aforementioned persons and companies. */
+/* */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
+/* */
+/* All rights reserved. */
+/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
+/**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "Control.h"
+
+#include "ActionCache.h"
+
+ActionCache::ActionCache()
+{
+ for (int i = 0; i < 256; i++)
+ {
+ base_[i] = new IntCache(8);
+ }
+
+ slot_ = 0;
+ last_ = 0;
+}
+
+ActionCache::~ActionCache()
+{
+ for (int i = 0; i < 256; i++)
+ {
+ delete base_[i];
+ }
+}
diff --git a/nxcomp/ActionCache.h b/nxcomp/src/ActionCache.h
index 23265fcf2..2aedd4a07 100644
--- a/nxcomp/ActionCache.h
+++ b/nxcomp/src/ActionCache.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ActionCache_H
diff --git a/nxcomp/Agent.cpp b/nxcomp/src/Agent.cpp
index c0b729d06..e55620601 100644
--- a/nxcomp/Agent.cpp
+++ b/nxcomp/src/Agent.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Misc.h"
#include "Agent.h"
#include "Proxy.h"
diff --git a/nxcomp/Agent.h b/nxcomp/src/Agent.h
index fac5acd43..3e1a50ae5 100644
--- a/nxcomp/Agent.h
+++ b/nxcomp/src/Agent.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Agent_H
@@ -149,30 +157,38 @@ class Agent
int remoteCanRead(const fd_set * const readSet)
{
+ // OS X 10.5 requires the second argument to be non-const, so copy readSet.
+ // It's safe though, as FD_ISSET does not operate on it.
+ fd_set readWorkSet = *readSet;
+
#if defined(TEST) || defined(INFO)
*logofs << "Agent: remoteCanRead() is " <<
- (FD_ISSET(remoteFd_, readSet) && transport_ -> dequeuable() != 0)
- << " with FD_ISSET() " << (int) FD_ISSET(remoteFd_, readSet)
+ (FD_ISSET(remoteFd_, &readWorkSet) && transport_ -> dequeuable() != 0)
+ << " with FD_ISSET() " << (int) FD_ISSET(remoteFd_, &readWorkSet)
<< " and dequeuable " << transport_ -> dequeuable()
<< ".\n" << logofs_flush;
#endif
- return (FD_ISSET(remoteFd_, readSet) &&
+ return (FD_ISSET(remoteFd_, &readWorkSet) &&
transport_ -> dequeuable() != 0);
}
int remoteCanWrite(const fd_set * const writeSet)
{
+ // OS X 10.5 requires the second argument to be non-const, so copy writeSet.
+ // It's safe though, as FD_ISSET does not operate on it.
+ fd_set writeWorkSet = *writeSet;
+
#if defined(TEST) || defined(INFO)
*logofs << "Agent: remoteCanWrite() is " <<
- (FD_ISSET(remoteFd_, writeSet) && transport_ ->
+ (FD_ISSET(remoteFd_, &writeWorkSet) && transport_ ->
queuable() != 0 && canRead_ == 1) << " with FD_ISSET() "
- << (int) FD_ISSET(remoteFd_, writeSet) << " queueable "
+ << (int) FD_ISSET(remoteFd_, &writeWorkSet) << " queueable "
<< transport_ -> queuable() << " channel can read "
<< canRead_ << ".\n" << logofs_flush;
#endif
- return (FD_ISSET(remoteFd_, writeSet) &&
+ return (FD_ISSET(remoteFd_, &writeWorkSet) &&
transport_ -> queuable() != 0 &&
canRead_ == 1);
}
@@ -203,13 +219,17 @@ class Agent
int proxyCanRead(const fd_set * const readSet)
{
+ // OS X 10.5 requires the second argument to be non-const, so copy readSet.
+ // It's safe though, as FD_ISSET does not operate on it.
+ fd_set readWorkSet = *readSet;
+
#if defined(TEST) || defined(INFO)
*logofs << "Agent: proxyCanRead() is "
- << ((int) FD_ISSET(proxy -> getFd(), readSet)
+ << ((int) FD_ISSET(proxy -> getFd(), &readWorkSet))
<< ".\n" << logofs_flush;
#endif
- return (FD_ISSET(proxy -> getFd(), readSet));
+ return (FD_ISSET(proxy -> getFd(), &readWorkSet));
}
int enqueueData(const char *data, const int size) const
diff --git a/nxcomp/Alpha.cpp b/nxcomp/src/Alpha.cpp
index 931101495..6157e21e5 100644
--- a/nxcomp/Alpha.cpp
+++ b/nxcomp/src/Alpha.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Misc.h"
#include "Unpack.h"
#include "Alpha.h"
diff --git a/nxcomp/Alpha.h b/nxcomp/src/Alpha.h
index 80620e1aa..ea5068812 100644
--- a/nxcomp/Alpha.h
+++ b/nxcomp/src/Alpha.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Alpha_H
diff --git a/nxcomp/Auth.cpp b/nxcomp/src/Auth.cpp
index d8e999132..d398f5f85 100644
--- a/nxcomp/Auth.cpp
+++ b/nxcomp/src/Auth.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Auth.h"
#include "Misc.h"
@@ -217,22 +229,31 @@ int Auth::getCookie()
//
// Use the nxauth command on Windows and the Mac, xauth
- // on all the other platforms. On Windows and on the Mac
- // we assume that the nxauth command is located under
- // bin in the client installation directory. On all the
+ // on all the other platforms. On Windows we assume that
+ // the nxauth command is located under bin in the client
+ // installation directory. On Mac OS X we assume that the
+ // command is located directly in the client installation
+ // directory, to make bundle shipping easier. On all the
// other platforms we use the default xauth command that
// is in our path.
//
char command[DEFAULT_STRING_LIMIT];
- #if defined(__CYGWIN32__) || defined(__APPLE__)
+ #if defined(__CYGWIN32__)
snprintf(command, DEFAULT_STRING_LIMIT - 1,
"%s/bin/nxauth", control -> SystemPath);
*(command + DEFAULT_STRING_LIMIT - 1) = '\0';
+ #elif defined(__APPLE__)
+
+ snprintf(command, DEFAULT_STRING_LIMIT - 1,
+ "%s/nxauth", control -> SystemPath);
+
+ *(command + DEFAULT_STRING_LIMIT - 1) = '\0';
+
#else
strcpy(command, "xauth");
@@ -258,11 +279,33 @@ int Auth::getCookie()
//
char line[DEFAULT_STRING_LIMIT];
+ FILE *data = NULL;
+ int result = -1;
if (strncmp(display_, "localhost:", 10) == 0)
{
snprintf(line, DEFAULT_STRING_LIMIT, "unix:%s", display_ + 10);
}
+ else if ((0 == strncasecmp(display_, "/tmp/launch", 11)) || (0 == strncasecmp(display_, "/private/tmp/com.apple.launchd", 30)))
+ {
+ /*
+ * Launchd socket support, mostly for OS X, but maybe also other BSD derivates.
+ */
+ const char *separator = strrchr(display_, ':');
+
+ if ((NULL == separator) || (!isdigit(*(separator + 1))))
+ {
+ #ifdef PANIC
+ *logofs << "Auth: PANIC! Unable to find separating colon character '"
+ << "in launchd socket path '" << display_
+ << "'.\n" << logofs_flush;
+ #endif
+
+ goto AuthGetCookieResult;
+ }
+
+ snprintf(line, DEFAULT_STRING_LIMIT, "unix:%s", separator + 1);
+ }
else
{
snprintf(line, DEFAULT_STRING_LIMIT, "%.200s", display_);
@@ -295,9 +338,7 @@ int Auth::getCookie()
// implementation.
//
- FILE *data = Popen((char *const *) parameters, "r");
-
- int result = -1;
+ data = Popen((char *const *) parameters, "r");
if (data == NULL)
{
diff --git a/nxcomp/Auth.h b/nxcomp/src/Auth.h
index aac1d1e3f..d51d9a26f 100644
--- a/nxcomp/Auth.h
+++ b/nxcomp/src/Auth.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Auth_H
diff --git a/nxcomp/Bitmap.cpp b/nxcomp/src/Bitmap.cpp
index b5bad226a..c89df53e3 100644
--- a/nxcomp/Bitmap.cpp
+++ b/nxcomp/src/Bitmap.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Misc.h"
#include "Bitmap.h"
diff --git a/nxcomp/Bitmap.h b/nxcomp/src/Bitmap.h
index 57a1b35bb..8143e3125 100644
--- a/nxcomp/Bitmap.h
+++ b/nxcomp/src/Bitmap.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Bitmap_H
diff --git a/nxcomp/BlockCache.cpp b/nxcomp/src/BlockCache.cpp
index f885290f0..161145e3d 100644
--- a/nxcomp/BlockCache.cpp
+++ b/nxcomp/src/BlockCache.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <string.h>
#include "BlockCache.h"
diff --git a/nxcomp/BlockCache.h b/nxcomp/src/BlockCache.h
index b9146ceea..48e586966 100644
--- a/nxcomp/BlockCache.h
+++ b/nxcomp/src/BlockCache.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef BlockCache_H
diff --git a/nxcomp/BlockCacheSet.cpp b/nxcomp/src/BlockCacheSet.cpp
index 8959ba2b3..1dd6361dc 100644
--- a/nxcomp/BlockCacheSet.cpp
+++ b/nxcomp/src/BlockCacheSet.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Misc.h"
#include "BlockCacheSet.h"
diff --git a/nxcomp/BlockCacheSet.h b/nxcomp/src/BlockCacheSet.h
index e27b18088..97273b0e0 100644
--- a/nxcomp/BlockCacheSet.h
+++ b/nxcomp/src/BlockCacheSet.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef BlockCacheSet_H
diff --git a/nxcomp/ChangeGC.cpp b/nxcomp/src/ChangeGC.cpp
index 574651763..e92178f27 100644
--- a/nxcomp/ChangeGC.cpp
+++ b/nxcomp/src/ChangeGC.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ChangeGC.h"
#include "ClientCache.h"
diff --git a/nxcomp/ChangeGC.h b/nxcomp/src/ChangeGC.h
index 81b808d87..9cac90e66 100644
--- a/nxcomp/ChangeGC.h
+++ b/nxcomp/src/ChangeGC.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ChangeGC_H
diff --git a/nxcomp/ChangeProperty.cpp b/nxcomp/src/ChangeProperty.cpp
index 0270d7274..74814c2ea 100644
--- a/nxcomp/ChangeProperty.cpp
+++ b/nxcomp/src/ChangeProperty.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ChangeProperty.h"
#include "ClientCache.h"
diff --git a/nxcomp/ChangeProperty.h b/nxcomp/src/ChangeProperty.h
index f941fced9..c06ce10fc 100644
--- a/nxcomp/ChangeProperty.h
+++ b/nxcomp/src/ChangeProperty.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ChangeProperty_H
diff --git a/nxcomp/Channel.cpp b/nxcomp/src/Channel.cpp
index 71b556b0d..e575a9e6b 100644
--- a/nxcomp/Channel.cpp
+++ b/nxcomp/src/Channel.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Channel.h"
#include "List.h"
@@ -386,16 +398,14 @@ int Channel::handleDecode(DecodeBuffer &decodeBuffer, ChannelCache *channelCache
if (store -> enableSplit == 1)
{
- if (control -> isProtoStep7() == 1)
- {
- #ifdef DEBUG
- *logofs << "handleDecode: " << store -> name()
- << ": Checking if the message was split.\n"
- << logofs_flush;
- #endif
+ // Since ProtoStep7 (#issue 108)
+ #ifdef DEBUG
+ *logofs << "handleDecode: " << store -> name()
+ << ": Checking if the message was split.\n"
+ << logofs_flush;
+ #endif
- decodeBuffer.decodeBoolValue(split);
- }
+ decodeBuffer.decodeBoolValue(split);
if (split == 1)
{
@@ -537,16 +547,9 @@ int Channel::handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channe
if (control -> LocalDeltaCompression == 0 ||
enableCache_ == 0 || store -> enableCache == 0)
{
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeActionValue(is_discarded,
- store -> lastActionCache);
- }
- else
- {
- encodeBuffer.encodeActionValueCompat(is_discarded,
- store -> lastActionCacheCompat);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeActionValue(is_discarded,
+ store -> lastActionCache);
store -> lastAction = is_discarded;
@@ -601,19 +604,9 @@ int Channel::handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channe
store -> lastRemoved = position;
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeActionValue(is_removed, store -> lastRemoved,
- store -> lastActionCache);
- }
- else
- {
- encodeBuffer.encodeActionValueCompat(is_removed,
- store -> lastActionCacheCompat);
-
- encodeBuffer.encodePositionValueCompat(store -> lastRemoved,
- store -> lastRemovedCacheCompat);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeActionValue(is_removed, store -> lastRemoved,
+ store -> lastActionCache);
#ifdef DEBUG
*logofs << "handleEncodeCached: " << store -> name() << ": Going to "
@@ -679,16 +672,9 @@ int Channel::handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channe
<< logofs_flush;
#endif
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeActionValue(is_discarded,
- store -> lastActionCache);
- }
- else
- {
- encodeBuffer.encodeActionValueCompat(is_discarded,
- store -> lastActionCacheCompat);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeActionValue(is_discarded,
+ store -> lastActionCache);
store -> lastAction = is_discarded;
@@ -759,16 +745,9 @@ int Channel::handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channe
<< logofs_flush;
#endif
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeActionValue(is_discarded,
- store -> lastActionCache);
- }
- else
- {
- encodeBuffer.encodeActionValueCompat(is_discarded,
- store -> lastActionCacheCompat);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeActionValue(is_discarded,
+ store -> lastActionCache);
store -> lastAction = is_discarded;
@@ -793,16 +772,9 @@ int Channel::handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channe
cerr << "Warning" << ": Message of size " << store -> plainSize(position)
<< " at position " << position << " is locked.\n";
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeActionValue(is_discarded,
- store -> lastActionCache);
- }
- else
- {
- encodeBuffer.encodeActionValueCompat(is_discarded,
- store -> lastActionCacheCompat);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeActionValue(is_discarded,
+ store -> lastActionCache);
store -> lastAction = is_discarded;
@@ -843,20 +815,9 @@ int Channel::handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channe
store -> lastAdded = position;
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeActionValue(IS_ADDED, store -> lastAdded,
- store -> lastActionCache);
-
- }
- else
- {
- encodeBuffer.encodeActionValueCompat(IS_ADDED,
- store -> lastActionCacheCompat);
-
- encodeBuffer.encodePositionValueCompat(store -> lastAdded,
- store -> lastAddedCacheCompat);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeActionValue(IS_ADDED, store -> lastAdded,
+ store -> lastActionCache);
return 0;
}
@@ -898,19 +859,9 @@ int Channel::handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channe
store -> lastHit = position;
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeActionValue(IS_HIT, store -> lastHit,
- store -> lastActionCache);
- }
- else
- {
- encodeBuffer.encodeActionValueCompat(IS_HIT,
- store -> lastActionCacheCompat);
-
- encodeBuffer.encodePositionValueCompat(store -> lastHit,
- store -> lastHitCacheCompat);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeActionValue(IS_HIT, store -> lastHit,
+ store -> lastActionCache);
//
// Send the field by field differences in
@@ -997,16 +948,9 @@ int Channel::handleDecodeCached(DecodeBuffer &decodeBuffer, ChannelCache *channe
unsigned char action;
unsigned short int position;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeActionValue(action, position,
- store -> lastActionCache);
- }
- else
- {
- decodeBuffer.decodeActionValueCompat(action,
- store -> lastActionCacheCompat);
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeActionValue(action, position,
+ store -> lastActionCache);
//
// Clean operations must always come
@@ -1015,15 +959,8 @@ int Channel::handleDecodeCached(DecodeBuffer &decodeBuffer, ChannelCache *channe
while (action == is_removed)
{
- if (control -> isProtoStep7() == 1)
- {
- store -> lastRemoved = position;
- }
- else
- {
- decodeBuffer.decodePositionValueCompat(store -> lastRemoved,
- store -> lastRemovedCacheCompat);
- }
+ // Since ProtoStep7 (#issue 108)
+ store -> lastRemoved = position;
#ifdef DEBUG
@@ -1046,16 +983,9 @@ int Channel::handleDecodeCached(DecodeBuffer &decodeBuffer, ChannelCache *channe
store -> remove(store -> lastRemoved, discard_checksum, use_data);
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeActionValue(action, position,
- store -> lastActionCache);
- }
- else
- {
- decodeBuffer.decodeActionValueCompat(action,
- store -> lastActionCacheCompat);
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeActionValue(action, position,
+ store -> lastActionCache);
}
//
@@ -1065,15 +995,8 @@ int Channel::handleDecodeCached(DecodeBuffer &decodeBuffer, ChannelCache *channe
if ((T_store_action) action == IS_HIT)
{
- if (control -> isProtoStep7() == 1)
- {
- store -> lastHit = position;
- }
- else
- {
- decodeBuffer.decodePositionValueCompat(store -> lastHit,
- store -> lastHitCacheCompat);
- }
+ // Since ProtoStep7 (#issue 108)
+ store -> lastHit = position;
//
// Get data from the cache at given position.
@@ -1139,15 +1062,8 @@ int Channel::handleDecodeCached(DecodeBuffer &decodeBuffer, ChannelCache *channe
}
else if ((T_store_action) action == IS_ADDED)
{
- if (control -> isProtoStep7() == 1)
- {
- store -> lastAdded = position;
- }
- else
- {
- decodeBuffer.decodePositionValueCompat(store -> lastAdded,
- store -> lastAddedCacheCompat);
- }
+ // Since ProtoStep7 (#issue 108)
+ store -> lastAdded = position;
#ifdef DEBUG
*logofs << "handleDecodeCached: " << store -> name()
@@ -1322,7 +1238,7 @@ int Channel::handleWait(int timeout)
}
#ifdef TEST
- *logofs << "handleWait: Waiting " << remaining << " Ms "
+ *logofs << "handleWait: Waiting " << remaining << " ms "
<< "for a new message on FD#" << fd_
<< ".\n" << logofs_flush;
#endif
@@ -1390,7 +1306,7 @@ int Channel::handleDrain(int limit, int timeout)
#ifdef TEST
*logofs << "handleDrain: Trying to write to FD#"
- << fd_ << " with " << remaining << " Ms "
+ << fd_ << " with " << remaining << " ms "
<< "remaining.\n" << logofs_flush;
#endif
@@ -2037,12 +1953,10 @@ Split *Channel::handleSplitCommitRemove(int request, int resource, int position)
<< ".\n" << logofs_flush;
#endif
- if ((control -> isProtoStep7() == 1 &&
- (resource != split -> getResource() ||
- request != split -> getRequest() ||
- position != split -> getPosition())) ||
- (request != split -> getRequest() ||
- position != split -> getPosition()))
+ // Since ProtoStep7 (#issue 108)
+ if (resource != split -> getResource() ||
+ request != split -> getRequest() ||
+ position != split -> getPosition())
{
#ifdef PANIC
*logofs << "handleSplitCommitRemove: PANIC! The data in "
diff --git a/nxcomp/Channel.h b/nxcomp/src/Channel.h
index 68fe1d7e9..7e432416a 100644
--- a/nxcomp/Channel.h
+++ b/nxcomp/src/Channel.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Channel_H
@@ -511,7 +519,7 @@ class Channel
// Set up the split stores.
//
- void handleSplitStoreError(int resource);
+ void handleSplitStoreError(int resource) __attribute__((noreturn));
void handleSplitStoreAlloc(List *list, int resource);
void handleSplitStoreRemove(List *list, int resource);
diff --git a/nxcomp/ChannelCache.cpp b/nxcomp/src/ChannelCache.cpp
index eaf8e426b..f30f18bc1 100644
--- a/nxcomp/ChannelCache.cpp
+++ b/nxcomp/src/ChannelCache.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ChannelCache.h"
const unsigned int CONFIGUREWINDOW_FIELD_WIDTH[7] =
diff --git a/nxcomp/ChannelCache.h b/nxcomp/src/ChannelCache.h
index 7b94893b6..6a29c3847 100644
--- a/nxcomp/ChannelCache.h
+++ b/nxcomp/src/ChannelCache.h
@@ -1,31 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ChannelCache_H
#define ChannelCache_H
//
-// Elements in array of caches used in TextCompressor.
-//
-
-const unsigned int CLIENT_TEXT_CACHE_SIZE = 9999;
-const unsigned int SERVER_TEXT_CACHE_SIZE = 9999;
-
-//
// Sizes of optional fields for ConfigureWindow
// request.
//
diff --git a/nxcomp/src/ChannelEndPoint.cpp b/nxcomp/src/ChannelEndPoint.cpp
new file mode 100644
index 000000000..fb8549f6a
--- /dev/null
+++ b/nxcomp/src/ChannelEndPoint.cpp
@@ -0,0 +1,363 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
+/* */
+/* NXCOMP, NX protocol compression and NX extensions to this software */
+/* are copyright of the aforementioned persons and companies. */
+/* */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
+/* */
+/* All rights reserved. */
+/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
+/**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/stat.h>
+
+#include "ChannelEndPoint.h"
+
+#include "NXalert.h"
+
+#include "Misc.h"
+
+ChannelEndPoint::ChannelEndPoint(const char *spec)
+ : defaultTCPPort_(0), defaultTCPInterface_(0),
+ defaultUnixPath_(NULL), spec_(NULL) {
+ setSpec(spec);
+}
+
+ChannelEndPoint::~ChannelEndPoint()
+{
+ char *unixPath = NULL;
+
+ if (getUnixPath(&unixPath))
+ {
+ struct stat st;
+ lstat(unixPath, &st);
+ if(S_ISSOCK(st.st_mode))
+ unlink(unixPath);
+ }
+ SAFE_FREE(unixPath);
+ SAFE_FREE(defaultUnixPath_);
+ SAFE_FREE(spec_);
+}
+
+void
+ChannelEndPoint::setSpec(const char *spec) {
+ SAFE_FREE(spec_);
+
+ if (spec && strlen(spec))
+ {
+ spec_ = strdup(spec);
+ isUnix_ = getUnixPath();
+ isTCP_ = getTCPHostAndPort();
+ }
+ else
+ {
+ spec_ = NULL;
+ isUnix_ = false;
+ isTCP_ = false;
+ }
+}
+
+void
+ChannelEndPoint::setSpec(long port) {
+ if (port >= 0) {
+ char tmp[20];
+ sprintf(tmp, "%ld", port);
+ setSpec(tmp);
+ }
+ else {
+ disable();
+ }
+}
+
+void
+ChannelEndPoint::setSpec(const char *hostName, long port) {
+ int length;
+
+ isUnix_ = false;
+ isTCP_ = false;
+
+ SAFE_FREE(spec_);
+
+ if (hostName && strlen(hostName) && port >= 1)
+ {
+ length = snprintf(NULL, 0, "tcp:%s:%ld", hostName, port);
+ spec_ = (char *)calloc(length + 1, sizeof(char));
+ snprintf(spec_, length+1, "tcp:%s:%ld", hostName, port);
+ isTCP_ = true;
+ }
+ else setSpec((char*)NULL);
+}
+
+bool
+ChannelEndPoint::getSpec(char **socketUri) const {
+
+ if (socketUri) *socketUri = NULL;
+
+ char *unixPath = NULL;
+ char *hostName = NULL;
+ long port = -1;
+
+ char *newSocketUri = NULL;
+ int length = -1;
+
+ if (getUnixPath(&unixPath))
+ {
+ length = snprintf(NULL, 0, "unix:%s", unixPath);
+ }
+ else if (getTCPHostAndPort(&hostName, &port))
+ {
+ length = snprintf(NULL, 0, "tcp:%s:%ld", hostName, port);
+ }
+
+ if (length > 0)
+ {
+ newSocketUri = (char *)calloc(length + 1, sizeof(char));
+ if (isUnixSocket())
+ snprintf(newSocketUri, length+1, "unix:%s", unixPath);
+ else
+ snprintf(newSocketUri, length+1, "tcp:%s:%ld", hostName, port);
+
+ if (socketUri)
+ *socketUri = strdup(newSocketUri);
+ }
+
+ SAFE_FREE(newSocketUri);
+ SAFE_FREE(unixPath);
+ SAFE_FREE(hostName);
+
+ if (NULL != *socketUri)
+ return true;
+
+ return false;
+}
+
+void
+ChannelEndPoint::setDefaultTCPPort(long port) {
+ defaultTCPPort_ = port;
+ isTCP_ = getTCPHostAndPort();
+}
+
+void
+ChannelEndPoint::setDefaultTCPInterface(int publicInterface) {
+ defaultTCPInterface_ = publicInterface;
+}
+
+void
+ChannelEndPoint::setDefaultUnixPath(char *path) {
+ SAFE_FREE(defaultUnixPath_);
+
+ if (path && strlen(path))
+ defaultUnixPath_ = strdup(path);
+ else
+ defaultUnixPath_ = NULL;
+
+ isUnix_ = getUnixPath();
+}
+
+void
+ChannelEndPoint::disable() {
+ setSpec("0");
+}
+
+bool
+ChannelEndPoint::getPort(long *port) const {
+ if (port) *port = 0;
+ long p = -1;
+ if (spec_) {
+ char *end;
+ p = strtol(spec_, &end, 10);
+ if ((end == spec_) || (*end != '\0'))
+ return false;
+ }
+
+ if (port) *port = p;
+ return true;
+}
+
+bool
+ChannelEndPoint::getUnixPath(char **unixPath) const {
+
+ if (unixPath) *unixPath = NULL;
+
+ long p;
+ char *path = NULL;
+
+ if (getPort(&p)) {
+ if (p != 1) return false;
+ }
+ else if (spec_ && (strncmp("unix:", spec_, 5) == 0)) {
+ path = spec_ + 5;
+ }
+ else
+ return false;
+
+ if (!path || (*path == '\0')) {
+ path = defaultUnixPath_;
+ if (!path)
+ return false;
+ }
+
+ if (unixPath)
+ *unixPath = strdup(path);
+
+ return true;
+}
+
+bool
+ChannelEndPoint::isUnixSocket() const {
+ return isUnix_;
+}
+
+// FIXME!!!
+static const char *
+getComputerName() {
+ //
+ // Strangely enough, under some Windows OSes SMB
+ // service doesn't bind to localhost. Fall back
+ // to localhost if can't find computer name in
+ // the environment. In future we should try to
+ // bind to localhost and then try the other IPs.
+ //
+
+ const char *hostname = NULL;
+
+ #ifdef __CYGWIN32__
+
+ hostname = getenv("COMPUTERNAME");
+
+ #endif
+
+ if (hostname == NULL)
+ {
+ hostname = "localhost";
+ }
+
+ return hostname;
+}
+
+bool
+ChannelEndPoint::getTCPHostAndPort(char **host, long *port) const {
+ long p;
+ char *h = NULL;
+ ssize_t h_len;
+
+ if (host) *host = NULL;
+ if (port) *port = 0;
+
+ if (getPort(&p)) {
+ h_len = 0;
+ }
+ else if (spec_ && (strncmp("tcp:", spec_, 4) == 0)) {
+ h = spec_ + 4;
+ char *colon = strrchr(h, ':');
+ if (colon) {
+ char *end;
+ h_len = colon++ - h;
+ p = strtol(colon, &end, 10);
+ if ((end == colon) || (*end != '\0'))
+ return false;
+ }
+ else {
+ h_len = strlen(h);
+ p = 1;
+ }
+ }
+ else
+ return false;
+
+ if (p == 1) p = defaultTCPPort_;
+ if (p < 1) return false;
+
+ if (port)
+ *port = p;
+
+ if (host)
+ *host = ( h_len
+ ? strndup(h, h_len)
+ : strdup(defaultTCPInterface_ ? getComputerName() : "localhost"));
+
+ return true;
+}
+
+bool
+ChannelEndPoint::isTCPSocket() const {
+ return isTCP_;
+}
+
+long ChannelEndPoint::getTCPPort() const {
+ long port;
+ if (getTCPHostAndPort(NULL, &port)) return port;
+ return -1;
+}
+
+bool
+ChannelEndPoint::enabled() const {
+ return (isUnixSocket() || isTCPSocket());
+}
+
+bool
+ChannelEndPoint::configured() const {
+ return ( spec_ && ( strcmp(spec_, "0") != 0) );
+}
+
+bool
+ChannelEndPoint::validateSpec() {
+ isTCP_ = getTCPHostAndPort();
+ isUnix_ = getUnixPath();
+ return ( getPort() || isUnix_ || isTCP_ );
+}
+
+ChannelEndPoint &ChannelEndPoint::operator=(const ChannelEndPoint &other) {
+ char *old;
+ defaultTCPPort_ = other.defaultTCPPort_;
+ defaultTCPInterface_ = other.defaultTCPInterface_;
+ old = defaultUnixPath_;
+ defaultUnixPath_ = (other.defaultUnixPath_ ? strdup(other.defaultUnixPath_) : NULL);
+ SAFE_FREE(old);
+ old = spec_;
+ spec_ = (other.spec_ ? strdup(other.spec_) : NULL);
+ SAFE_FREE(old);
+ isUnix_ = getUnixPath();
+ isTCP_ = getTCPHostAndPort();
+ return *this;
+}
+
+std::ostream& operator<<(std::ostream& os, const ChannelEndPoint& endPoint) {
+ if (endPoint.enabled()) {
+ char* endPointSpec = NULL;
+ if (endPoint.getSpec(&endPointSpec))
+ {
+ os << endPointSpec;
+ SAFE_FREE(endPointSpec);
+ }
+ else
+ os << "(invalid)";
+ }
+ else
+ {
+ os << "(disabled)";
+ }
+ return os;
+}
diff --git a/nxcomp/src/ChannelEndPoint.h b/nxcomp/src/ChannelEndPoint.h
new file mode 100644
index 000000000..652492485
--- /dev/null
+++ b/nxcomp/src/ChannelEndPoint.h
@@ -0,0 +1,72 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
+/* */
+/* NXCOMP, NX protocol compression and NX extensions to this software */
+/* are copyright of the aforementioned persons and companies. */
+/* */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
+/* */
+/* All rights reserved. */
+/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
+/**************************************************************************/
+
+#ifndef ChannelEndPoint_H
+#define ChannelEndPoint_H
+
+#include <iostream>
+#include <sys/un.h>
+
+class ChannelEndPoint
+{
+ private:
+ long defaultTCPPort_;
+ int defaultTCPInterface_; // 0=localhost, otherwise IP of public interface.
+ char *defaultUnixPath_;
+ char *spec_;
+ bool isUnix_;
+ bool isTCP_;
+
+ bool getPort(long *port = NULL) const;
+
+ public:
+ ChannelEndPoint(const char *spec = NULL);
+ ~ChannelEndPoint();
+ ChannelEndPoint &operator=(const ChannelEndPoint &other);
+
+ bool configured() const;
+ bool enabled() const;
+ bool disabled() { return !enabled(); }
+ void disable();
+ void setSpec(const char *spec);
+ void setSpec(long port);
+ void setSpec(const char *hostName, long port);
+ bool getSpec(char **socketUri) const;
+ void setDefaultTCPPort(long port);
+ void setDefaultTCPInterface(int publicInterface);
+ void setDefaultUnixPath(char *path);
+
+ bool getUnixPath(char **path = NULL) const;
+ bool isUnixSocket() const;
+ bool getTCPHostAndPort(char **hostname = NULL, long *port = NULL) const;
+ long getTCPPort() const;
+ bool isTCPSocket() const;
+
+ bool validateSpec();
+};
+
+std::ostream& operator<<(std::ostream& os, const ChannelEndPoint& endPoint);
+
+#endif
diff --git a/nxcomp/ChannelStore.h b/nxcomp/src/ChannelStore.h
index 3103fb308..53bb60f73 100644
--- a/nxcomp/ChannelStore.h
+++ b/nxcomp/src/ChannelStore.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ChannelStore_H
diff --git a/nxcomp/CharCache.cpp b/nxcomp/src/CharCache.cpp
index 2803a1b1d..ed0e5a02a 100644
--- a/nxcomp/CharCache.cpp
+++ b/nxcomp/src/CharCache.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "CharCache.h"
int CharCache::lookup(unsigned char value, unsigned int &index)
diff --git a/nxcomp/CharCache.h b/nxcomp/src/CharCache.h
index 53710f181..b8891d2df 100644
--- a/nxcomp/CharCache.h
+++ b/nxcomp/src/CharCache.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef CharCache_H
diff --git a/nxcomp/Children.cpp b/nxcomp/src/Children.cpp
index a19b882e8..9486f189a 100644
--- a/nxcomp/Children.cpp
+++ b/nxcomp/src/Children.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
@@ -52,7 +64,7 @@
extern Keeper *keeper;
-extern int (*handler)(int);
+extern int (*signalHandler)(int);
extern int useUnixSocket;
@@ -252,58 +264,63 @@ int NXTransDialog(const char *caption, const char *message,
// in the default NX path.
//
- strcpy(command, "nxclient");
+ if (i == 0)
+ {
- char newPath[DEFAULT_STRING_LIMIT];
+ strcpy(command, "nxclient");
- strcpy(newPath, "/usr/NX/bin:/opt/NX/bin:/usr/local/NX/bin:");
+ char newPath[DEFAULT_STRING_LIMIT];
- #ifdef __APPLE__
+ strcpy(newPath, "/usr/NX/bin:/opt/NX/bin:/usr/local/NX/bin:");
- strcat(newPath, "/Applications/NX Client for OSX.app/Contents/MacOS:");
+ #ifdef __APPLE__
- #endif
+ strcat(newPath, "/Applications/NX Client for OSX.app/Contents/MacOS:");
- #ifdef __CYGWIN32__
+ #endif
- strcat(newPath, ".:");
+ #ifdef __CYGWIN32__
- #endif
+ strcat(newPath, ".:");
- int newLength = strlen(newPath);
+ #endif
- char *oldPath = getenv("PATH");
+ int newLength = strlen(newPath);
- strncpy(newPath + newLength, oldPath, DEFAULT_STRING_LIMIT - newLength - 1);
+ char *oldPath = getenv("PATH");
- newPath[DEFAULT_STRING_LIMIT - 1] = '\0';
+ strncpy(newPath + newLength, oldPath, DEFAULT_STRING_LIMIT - newLength - 1);
- #ifdef WARNING
- *logofs << "NXTransDialog: WARNING! Trying with path '"
- << newPath << "'.\n" << logofs_flush;
- #endif
+ newPath[DEFAULT_STRING_LIMIT - 1] = '\0';
- cerr << "Warning" << ": Trying with path '" << newPath
- << "'.\n";
+ #ifdef WARNING
+ *logofs << "NXTransDialog: WARNING! Trying with path '"
+ << newPath << "'.\n" << logofs_flush;
+ #endif
- //
- // Solaris doesn't seem to have
- // function setenv().
- //
+ cerr << "Warning" << ": Trying with path '" << newPath
+ << "'.\n";
- #ifdef __sun
+ //
+ // Solaris doesn't seem to have
+ // function setenv().
+ //
- char newEnv[DEFAULT_STRING_LIMIT + 5];
+ #ifdef __sun
- sprintf(newEnv,"PATH=%s", newPath);
+ char newEnv[DEFAULT_STRING_LIMIT + 5];
- putenv(newEnv);
+ sprintf(newEnv,"PATH=%s", newPath);
- #else
+ putenv(newEnv);
- setenv("PATH", newPath, 1);
+ #else
- #endif
+ setenv("PATH", newPath, 1);
+
+ #endif
+
+ }
}
//
@@ -447,60 +464,64 @@ int NXTransClient(const char* display)
// in the default NX path.
//
- strcpy(command, "nxclient");
+ if (i == 0)
+ {
- char newPath[DEFAULT_STRING_LIMIT];
+ strcpy(command, "nxclient");
- strcpy(newPath, "/usr/NX/bin:/opt/NX/bin:/usr/local/NX/bin:");
+ char newPath[DEFAULT_STRING_LIMIT];
- #ifdef __APPLE__
+ strcpy(newPath, "/usr/NX/bin:/opt/NX/bin:/usr/local/NX/bin:");
- strcat(newPath, "/Applications/NX Client for OSX.app/Contents/MacOS:");
+ #ifdef __APPLE__
- #endif
+ strcat(newPath, "/Applications/NX Client for OSX.app/Contents/MacOS:");
- #ifdef __CYGWIN32__
+ #endif
- strcat(newPath, ".:");
+ #ifdef __CYGWIN32__
- #endif
+ strcat(newPath, ".:");
- int newLength = strlen(newPath);
+ #endif
- char *oldPath = getenv("PATH");
+ int newLength = strlen(newPath);
- strncpy(newPath + newLength, oldPath, DEFAULT_STRING_LIMIT - newLength - 1);
+ char *oldPath = getenv("PATH");
- newPath[DEFAULT_STRING_LIMIT - 1] = '\0';
+ strncpy(newPath + newLength, oldPath, DEFAULT_STRING_LIMIT - newLength - 1);
- #ifdef WARNING
- *logofs << "NXTransClient: WARNING! Trying with path '"
- << newPath << "'.\n" << logofs_flush;
- #endif
+ newPath[DEFAULT_STRING_LIMIT - 1] = '\0';
- cerr << "Warning" << ": Trying with path '" << newPath
- << "'.\n";
+ #ifdef WARNING
+ *logofs << "NXTransClient: WARNING! Trying with path '"
+ << newPath << "'.\n" << logofs_flush;
+ #endif
- //
- // Solaris doesn't seem to have
- // function setenv().
- //
+ cerr << "Warning" << ": Trying with path '" << newPath
+ << "'.\n";
- #ifdef __sun
+ //
+ // Solaris doesn't seem to have
+ // function setenv().
+ //
- char newEnv[DEFAULT_STRING_LIMIT + 5];
+ #ifdef __sun
- sprintf(newEnv,"PATH=%s", newPath);
+ char newEnv[DEFAULT_STRING_LIMIT + 5];
- putenv(newEnv);
+ sprintf(newEnv,"PATH=%s", newPath);
- #else
+ putenv(newEnv);
- setenv("PATH", newPath, 1);
+ #else
- #endif
- }
+ setenv("PATH", newPath, 1);
+ #endif
+ }
+
+ }
//
// Hopefully useless.
//
@@ -607,7 +628,7 @@ int NXTransWatchdog(int timeout)
{
#ifdef TEST
*logofs << "NXTransWatchdog: Timeout of " << timeout
- << " Ms raised in watchdog.\n" << logofs_flush;
+ << " ms raised in watchdog.\n" << logofs_flush;
#endif
//
@@ -624,7 +645,7 @@ int NXTransWatchdog(int timeout)
{
#ifdef TEST
*logofs << "NXTransWatchdog: Waiting for the timeout "
- << "with " << timeout - diffTs << " Ms to run.\n"
+ << "with " << timeout - diffTs << " ms to run.\n"
<< logofs_flush;
#endif
@@ -771,7 +792,7 @@ int NXTransKeeper(int caches, int images, const char *root)
keeper = new Keeper(caches, images, root, 100, parent);
- handler = NXTransKeeperHandler;
+ signalHandler = NXTransKeeperHandler;
if (keeper == NULL)
{
@@ -826,7 +847,7 @@ int NXTransKeeper(int caches, int images, const char *root)
#ifdef TEST
*logofs << "NXTransKeeper: Going to sleep for "
- << timeout / 20 << " Ms.\n" << logofs_flush;
+ << timeout / 20 << " ms.\n" << logofs_flush;
#endif
usleep(timeout / 20 * 1000);
@@ -916,7 +937,7 @@ int NXTransKeeper(int caches, int images, const char *root)
#ifdef TEST
*logofs << "NXTransKeeper: Going to sleep for " << timeout
- << " Ms.\n" << logofs_flush;
+ << " ms.\n" << logofs_flush;
#endif
usleep(timeout * 1000);
diff --git a/nxcomp/ClearArea.cpp b/nxcomp/src/ClearArea.cpp
index 223a3b3e1..0cb152d95 100644
--- a/nxcomp/ClearArea.cpp
+++ b/nxcomp/src/ClearArea.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ClearArea.h"
#include "ClientCache.h"
@@ -92,7 +104,7 @@ void ClearAreaStore::dumpIdentity(const Message *message) const
ClearAreaMessage *clearArea = (ClearAreaMessage *) message;
- *logofs << name() << ": Identity exposures " << clearArea -> (unsigned int) exposures
+ *logofs << name() << ": Identity exposures " << (unsigned int) clearArea -> exposures
<< ", window " << clearArea -> window << ", x " << clearArea -> x
<< ", y " << clearArea -> y << ", width " << clearArea -> width
<< ", height " << clearArea -> height << ", size " << clearArea -> size_
diff --git a/nxcomp/ClearArea.h b/nxcomp/src/ClearArea.h
index 039eea44e..8067edffd 100644
--- a/nxcomp/ClearArea.h
+++ b/nxcomp/src/ClearArea.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ClearArea_H
diff --git a/nxcomp/ClientCache.cpp b/nxcomp/src/ClientCache.cpp
index 2a82009a3..47bb7db1d 100644
--- a/nxcomp/ClientCache.cpp
+++ b/nxcomp/src/ClientCache.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ClientCache.h"
ClientCache::ClientCache() :
@@ -25,7 +37,6 @@ ClientCache::ClientCache() :
changePropertyPropertyCache(16), changePropertyTypeCache(16),
changePropertyData32Cache(16),
- changePropertyTextCompressor(textCache, CLIENT_TEXT_CACHE_SIZE),
configureWindowBitmaskCache(4),
@@ -53,17 +64,11 @@ ClientCache::ClientCache() :
imageTextLengthCache(8),
imageTextLastX(0), imageTextLastY(0),
imageTextCacheX(8), imageTextCacheY(8),
- imageTextTextCompressor(textCache, CLIENT_TEXT_CACHE_SIZE),
-
- internAtomTextCompressor(textCache, CLIENT_TEXT_CACHE_SIZE),
-
- openFontTextCompressor(textCache, CLIENT_TEXT_CACHE_SIZE),
polySegmentCacheX(8), polySegmentCacheY(8), polySegmentCacheIndex(0),
polyTextLastX(0), polyTextLastY(0), polyTextCacheX(8),
polyTextCacheY(8), polyTextFontCache(8),
- polyTextTextCompressor(textCache, CLIENT_TEXT_CACHE_SIZE),
putImageWidthCache(8), putImageHeightCache(8), putImageLastX(0),
putImageLastY(0), putImageXCache(8), putImageYCache(8),
@@ -107,8 +112,6 @@ ClientCache::ClientCache() :
renderLastId(0),
- renderTextCompressor(textCache, CLIENT_TEXT_CACHE_SIZE),
-
renderGlyphXCache(16), renderGlyphYCache(16),
renderGlyphX(0), renderGlyphY(0),
diff --git a/nxcomp/ClientCache.h b/nxcomp/src/ClientCache.h
index 6702e5b66..ed3361097 100644
--- a/nxcomp/ClientCache.h
+++ b/nxcomp/src/ClientCache.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ClientCache_H
@@ -26,8 +34,6 @@
#include "XidCache.h"
#include "FreeCache.h"
-#include "TextCompressor.h"
-
#include "ChannelCache.h"
class ClientCache : public ChannelCache
@@ -61,7 +67,6 @@ class ClientCache : public ChannelCache
// General-purpose caches.
//
- CharCache textCache[CLIENT_TEXT_CACHE_SIZE];
IntCache cursorCache;
IntCache colormapCache;
IntCache visualCache;
@@ -85,7 +90,6 @@ class ClientCache : public ChannelCache
IntCache changePropertyPropertyCache;
IntCache changePropertyTypeCache;
IntCache changePropertyData32Cache;
- TextCompressor changePropertyTextCompressor;
//
// ClearArea request.
@@ -188,19 +192,6 @@ class ClientCache : public ChannelCache
unsigned int imageTextLastY;
IntCache imageTextCacheX;
IntCache imageTextCacheY;
- TextCompressor imageTextTextCompressor;
-
- //
- // InternAtom request.
- //
-
- TextCompressor internAtomTextCompressor;
-
- //
- // OpenFont request.
- //
-
- TextCompressor openFontTextCompressor;
//
// PolyFillRectangle request.
@@ -251,7 +242,6 @@ class ClientCache : public ChannelCache
IntCache polyTextCacheY;
IntCache polyTextFontCache;
CharCache polyTextDeltaCache;
- TextCompressor polyTextTextCompressor;
//
// PutImage request.
@@ -398,8 +388,6 @@ class ClientCache : public ChannelCache
IntCache *renderDataCache[16];
- TextCompressor renderTextCompressor;
-
IntCache renderGlyphXCache;
IntCache renderGlyphYCache;
diff --git a/nxcomp/ClientChannel.cpp b/nxcomp/src/ClientChannel.cpp
index 31d6d125a..1c6354897 100644
--- a/nxcomp/ClientChannel.cpp
+++ b/nxcomp/src/ClientChannel.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <string.h>
#include <X11/X.h>
@@ -155,13 +167,6 @@ ClientChannel::ClientChannel(Transport *transport, StaticCompressor *compressor)
splitState_.mode = split_none;
//
- // Disable image streaming if the remote
- // doesn't support our proxy version.
- //
-
- handleSplitEnable();
-
- //
// Number of outstanding tainted replies.
//
@@ -342,10 +347,8 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
// previous versions.
//
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeValue(inputLength, 8);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeValue(inputLength, 8);
for (unsigned int i = 0; i < inputLength; i++)
{
@@ -364,20 +367,6 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
#endif
priority_++;
-
- //
- // Due to the way the loop was implemented
- // we can't encode multiple messages if we
- // are encoding the first request.
- //
-
- if (control -> isProtoStep7() == 0)
- {
- if (proxy -> handleAsyncInit() < 0)
- {
- return -1;
- }
- }
}
else
{
@@ -512,17 +501,8 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
const unsigned char *nextSrc = inputMessage + 24;
if (format == 8)
{
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(nextSrc, dataLength);
- }
- else
- {
- clientCache_ -> changePropertyTextCompressor.reset();
- for (unsigned int i = 0; i < dataLength; i++)
- clientCache_ -> changePropertyTextCompressor.
- encodeChar(*nextSrc++, encodeBuffer);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(nextSrc, dataLength);
}
else if (format == 32)
{
@@ -717,10 +697,10 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
*(clientCache_ -> convertSelectionAtomCache[i]), 9);
nextSrc += 4;
}
- unsigned int timestamp = GetULONG(nextSrc, bigEndian_);
- encodeBuffer.encodeValue(timestamp -
+ unsigned int _timestamp = GetULONG(nextSrc, bigEndian_);
+ encodeBuffer.encodeValue(_timestamp -
clientCache_ -> convertSelectionLastTimestamp, 32, 4);
- clientCache_ -> convertSelectionLastTimestamp = timestamp;
+ clientCache_ -> convertSelectionLastTimestamp = _timestamp;
}
break;
case X_CopyArea:
@@ -872,18 +852,11 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
break;
}
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeNewXidValue(GetULONG(inputMessage + 4, bigEndian_),
- clientCache_ -> lastId, clientCache_ -> lastIdCache,
- clientCache_ -> gcCache,
- clientCache_ -> freeGCCache);
- }
- else
- {
- encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4,
- bigEndian_), clientCache_ -> gcCache);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeNewXidValue(GetULONG(inputMessage + 4, bigEndian_),
+ clientCache_ -> lastId, clientCache_ -> lastIdCache,
+ clientCache_ -> gcCache,
+ clientCache_ -> freeGCCache);
const unsigned char *nextSrc = inputMessage + 8;
encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8,
@@ -1059,18 +1032,12 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_),
clientCache_ -> windowCache);
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeNewXidValue(GetULONG(inputMessage + 4, bigEndian_),
- clientCache_ -> lastId, clientCache_ -> lastIdCache,
- clientCache_ -> windowCache,
- clientCache_ -> freeWindowCache);
- }
- else
- {
- encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_),
- clientCache_ -> windowCache);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeNewXidValue(GetULONG(inputMessage + 4, bigEndian_),
+ clientCache_ -> lastId, clientCache_ -> lastIdCache,
+ clientCache_ -> windowCache,
+ clientCache_ -> freeWindowCache);
+
const unsigned char *nextSrc = inputMessage + 12;
for (unsigned int i = 0; i < 6; i++)
{
@@ -1140,16 +1107,9 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
unsigned int numPoints = ((inputLength - 16) >> 2);
- if (control -> isProtoStep10() == 1)
- {
- encodeBuffer.encodeCachedValue(numPoints, 16,
- clientCache_ -> fillPolyNumPointsCache, 4);
- }
- else
- {
- encodeBuffer.encodeCachedValue(numPoints, 14,
- clientCache_ -> fillPolyNumPointsCache, 4);
- }
+ // Since ProtoStep10 (#issue 108)
+ encodeBuffer.encodeCachedValue(numPoints, 16,
+ clientCache_ -> fillPolyNumPointsCache, 4);
encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_),
clientCache_ -> drawableCache);
@@ -1270,16 +1230,9 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
#endif
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_),
- clientCache_ -> freeGCCache);
- }
- else
- {
- encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_),
- clientCache_ -> gcCache);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_),
+ clientCache_ -> freeGCCache);
}
break;
case X_FreePixmap:
@@ -1294,26 +1247,9 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
#endif
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_),
- clientCache_ -> freeDrawableCache);
- }
- else
- {
- unsigned int pixmap = GetULONG(inputMessage + 4, bigEndian_);
- unsigned int diff = pixmap - clientCache_ -> createPixmapLastId;
- if (diff == 0)
- {
- encodeBuffer.encodeBoolValue(1);
- }
- else
- {
- encodeBuffer.encodeBoolValue(0);
- clientCache_ -> createPixmapLastId = pixmap;
- encodeBuffer.encodeValue(diff, 29, 4);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_),
+ clientCache_ -> freeDrawableCache);
}
break;
case X_GetAtomName:
@@ -1436,10 +1372,10 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16,
bigEndian_), 29, clientCache_ -> cursorCache, 9);
- unsigned int timestamp = GetULONG(inputMessage + 20, bigEndian_);
- encodeBuffer.encodeValue(timestamp -
+ unsigned int _timestamp = GetULONG(inputMessage + 20, bigEndian_);
+ encodeBuffer.encodeValue(_timestamp -
clientCache_ -> grabKeyboardLastTimestamp, 32, 4);
- clientCache_ -> grabKeyboardLastTimestamp = timestamp;
+ clientCache_ -> grabKeyboardLastTimestamp = _timestamp;
sequenceQueue_.push(clientSequence_, inputOpcode);
@@ -1451,10 +1387,10 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]);
encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_),
clientCache_ -> windowCache);
- unsigned int timestamp = GetULONG(inputMessage + 8, bigEndian_);
- encodeBuffer.encodeValue(timestamp -
+ unsigned int _timestamp = GetULONG(inputMessage + 8, bigEndian_);
+ encodeBuffer.encodeValue(_timestamp -
clientCache_ -> grabKeyboardLastTimestamp, 32, 4);
- clientCache_ -> grabKeyboardLastTimestamp = timestamp;
+ clientCache_ -> grabKeyboardLastTimestamp = _timestamp;
encodeBuffer.encodeBoolValue((unsigned int) inputMessage[12]);
encodeBuffer.encodeBoolValue((unsigned int) inputMessage[13]);
@@ -1536,18 +1472,9 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
encodeBuffer.encodeCachedValue(*nextSrc++, 8,
clientCache_ -> polyTextDeltaCache);
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(nextSrc, textLength);
-
- nextSrc += textLength;
- }
- else
- {
- clientCache_ -> polyTextTextCompressor.reset();
- for (unsigned int i = 0; i < textLength; i++)
- clientCache_ -> polyTextTextCompressor.encodeChar(*nextSrc++, encodeBuffer);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(nextSrc, textLength);
+ nextSrc += textLength;
}
}
encodeBuffer.encodeBoolValue(0);
@@ -1620,18 +1547,9 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
encodeBuffer.encodeCachedValue(*nextSrc++, 8,
clientCache_ -> polyTextDeltaCache);
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(nextSrc, textLength * 2);
-
- nextSrc += textLength * 2;
- }
- else
- {
- clientCache_ -> polyTextTextCompressor.reset();
- for (unsigned int i = 0; i < textLength * 2; i++)
- clientCache_ -> polyTextTextCompressor.encodeChar(*nextSrc++, encodeBuffer);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(nextSrc, textLength * 2);
+ nextSrc += textLength * 2;
}
}
encodeBuffer.encodeBoolValue(0);
@@ -1692,16 +1610,8 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
clientCache_ -> imageTextCacheY);
const unsigned char *nextSrc = inputMessage + 16;
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(nextSrc, textLength);
- }
- else
- {
- clientCache_ -> imageTextTextCompressor.reset();
- for (unsigned int j = 0; j < textLength; j++)
- clientCache_ -> imageTextTextCompressor.encodeChar(*nextSrc++, encodeBuffer);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(nextSrc, textLength);
}
break;
case X_ImageText16:
@@ -1759,16 +1669,8 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
clientCache_ -> imageTextCacheY);
const unsigned char *nextSrc = inputMessage + 16;
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(nextSrc, textLength * 2);
- }
- else
- {
- clientCache_ -> imageTextTextCompressor.reset();
- for (unsigned int j = 0; j < textLength * 2; j++)
- clientCache_ -> imageTextTextCompressor.encodeChar(*nextSrc++, encodeBuffer);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(nextSrc, textLength * 2);
}
break;
case X_InternAtom:
@@ -1800,18 +1702,8 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]);
const unsigned char *nextSrc = inputMessage + 8;
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(nextSrc, nameLength);
- }
- else
- {
- clientCache_ -> internAtomTextCompressor.reset();
- for (unsigned int i = 0; i < nameLength; i++)
- {
- clientCache_ -> internAtomTextCompressor.encodeChar(*nextSrc++, encodeBuffer);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(nextSrc, nameLength);
sequenceQueue_.push(clientSequence_, inputOpcode);
@@ -1832,18 +1724,8 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
encodeBuffer.encodeValue(GetUINT(inputMessage + 4, bigEndian_), 16, 6);
const unsigned char* nextSrc = inputMessage + 8;
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(nextSrc, textLength);
- }
- else
- {
- clientCache_ -> polyTextTextCompressor.reset();
- for (unsigned int i = 0; i < textLength; i++)
- {
- clientCache_ -> polyTextTextCompressor.encodeChar(*nextSrc++, encodeBuffer);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(nextSrc, textLength);
sequenceQueue_.push(clientSequence_, inputOpcode);
@@ -1859,18 +1741,8 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
29, clientCache_ -> colormapCache);
const unsigned char *nextSrc = inputMessage + 12;
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(nextSrc, textLength);
- }
- else
- {
- clientCache_ -> polyTextTextCompressor.reset();
- for (unsigned int i = 0; i < textLength; i++)
- {
- clientCache_ -> polyTextTextCompressor.encodeChar(*nextSrc++, encodeBuffer);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(nextSrc, textLength);
sequenceQueue_.push(clientSequence_, inputOpcode);
@@ -1900,8 +1772,9 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
#endif
- if (inputOpcode == X_DestroyWindow && control -> isProtoStep7() == 1)
+ if (inputOpcode == X_DestroyWindow)
{
+ // Since ProtoStep7 (#issue 108)
encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_),
clientCache_ -> freeWindowCache);
}
@@ -1930,19 +1803,8 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
clientCache_ -> lastFont = font;
const unsigned char *nextSrc = inputMessage + 12;
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(nextSrc, nameLength);
- }
- else
- {
- clientCache_ -> openFontTextCompressor.reset();
- for (; nameLength; nameLength--)
- {
- clientCache_ -> openFontTextCompressor.
- encodeChar(*nextSrc++, encodeBuffer);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(nextSrc, nameLength);
}
break;
case X_PolyFillRectangle:
@@ -2638,14 +2500,8 @@ int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
unsigned int numRectangles = ((inputLength - 12) >> 3);
- if (control -> isProtoStep9() == 1)
- {
- encodeBuffer.encodeValue(numRectangles, 15, 4);
- }
- else
- {
- encodeBuffer.encodeValue(numRectangles, 13, 4);
- }
+ // Since ProtoStep9 (#issue 108)
+ encodeBuffer.encodeValue(numRectangles, 15, 4);
encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2);
encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_),
@@ -3544,19 +3400,8 @@ int ClientChannel::handleWrite(const unsigned char *message, unsigned int length
PutUINT(nameLength, outputMessage + 8, bigEndian_);
unsigned char* nextDest = outputMessage + 32;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(nextDest, nameLength);
- }
- else
- {
- serverCache_ -> getAtomNameTextCompressor.reset();
- for (unsigned int i = 0; i < nameLength; i++)
- {
- *nextDest++ = serverCache_ -> getAtomNameTextCompressor.
- decodeChar(decodeBuffer);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(nextDest, nameLength);
}
break;
case X_GetGeometry:
@@ -3762,10 +3607,10 @@ int ClientChannel::handleWrite(const unsigned char *message, unsigned int length
unsigned char *nextDest = outputMessage + 32;
for (; numExtensions; numExtensions--)
{
- unsigned int length;
- decodeBuffer.decodeValue(length, 8);
- *nextDest++ = (unsigned char) length;
- for (; length; length--)
+ unsigned int _length;
+ decodeBuffer.decodeValue(_length, 8);
+ *nextDest++ = (unsigned char) _length;
+ for (; _length; _length--)
{
decodeBuffer.decodeValue(value, 8);
*nextDest++ = value;
@@ -3810,25 +3655,13 @@ int ClientChannel::handleWrite(const unsigned char *message, unsigned int length
unsigned char* nextDest = outputMessage + 32;
for (; numFonts; numFonts--)
{
- unsigned int length;
- decodeBuffer.decodeValue(length, 8);
- *nextDest++ = (unsigned char)length;
+ unsigned int _length;
+ decodeBuffer.decodeValue(_length, 8);
+ *nextDest++ = (unsigned char)_length;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(nextDest, length);
-
- nextDest += length;
- }
- else
- {
- serverCache_ -> getPropertyTextCompressor.reset();
- for (; length; length--)
- {
- *nextDest++ = serverCache_ -> getPropertyTextCompressor.
- decodeChar(decodeBuffer);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(nextDest, _length);
+ nextDest += _length;
}
handleSave(messageStore, outputMessage, outputLength);
@@ -4071,10 +3904,10 @@ int ClientChannel::handleWrite(const unsigned char *message, unsigned int length
{
unsigned int index;
decodeBuffer.decodeValue(index, 4);
- unsigned int length;
+ unsigned int _length;
const unsigned char *data;
- ServerCache::queryFontFontCache.get(index, length, data);
- memcpy(nextDest, data, length);
+ ServerCache::queryFontFontCache.get(index, _length, data);
+ memcpy(nextDest, data, _length);
end = 1;
}
@@ -4082,7 +3915,7 @@ int ClientChannel::handleWrite(const unsigned char *message, unsigned int length
if (end == 0)
{
unsigned char *saveDest = nextDest;
- unsigned int length = numProperties * 8 + numCharInfos * 12;
+ unsigned int _length = numProperties * 8 + numCharInfos * 12;
for (; numProperties; numProperties--)
{
decodeBuffer.decodeValue(value, 32, 9);
@@ -4097,7 +3930,7 @@ int ClientChannel::handleWrite(const unsigned char *message, unsigned int length
nextDest += 12;
}
- ServerCache::queryFontFontCache.set(length, saveDest);
+ ServerCache::queryFontFontCache.set(_length, saveDest);
}
handleSave(messageStore, outputMessage, outputLength);
@@ -4243,35 +4076,11 @@ int ClientChannel::handleWrite(const unsigned char *message, unsigned int length
serverCache_ -> visualCache);
PutULONG(visual, outputMessage + 8, bigEndian_);
- if (control -> isProtoStep8() == 0)
- {
- const unsigned char *compressedData = NULL;
- unsigned int compressedDataSize = 0;
+ // Since ProtoStep8 (#issue 108)
+ handleCopy(decodeBuffer, requestOpcode, messageStore ->
+ dataOffset, outputMessage, outputLength);
- int decompressed = handleDecompress(decodeBuffer, requestOpcode, messageStore -> dataOffset,
- outputMessage, outputLength, compressedData,
- compressedDataSize);
- if (decompressed < 0)
- {
- return -1;
- }
- else if (decompressed > 0)
- {
- handleSave(messageStore, outputMessage, outputLength,
- compressedData, compressedDataSize);
- }
- else
- {
- handleSave(messageStore, outputMessage, outputLength);
- }
- }
- else
- {
- handleCopy(decodeBuffer, requestOpcode, messageStore ->
- dataOffset, outputMessage, outputLength);
-
- handleSave(messageStore, outputMessage, outputLength);
- }
+ handleSave(messageStore, outputMessage, outputLength);
}
break;
case X_GetPointerMapping:
@@ -5090,40 +4899,23 @@ int ClientChannel::handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store,
{
#if defined(TEST) || defined(SPLIT)
- if (control -> isProtoStep8() == 1)
- {
- *logofs << "handleSplit: PANIC! SPLIT! Split should "
- << "not be enabled for message " << "OPCODE#"
- << (unsigned int) store -> opcode() << ".\n"
- << logofs_flush;
+ // Since ProtoStep8 (#issue 108)
+ *logofs << "handleSplit: PANIC! SPLIT! Split should "
+ << "not be enabled for message " << "OPCODE#"
+ << (unsigned int) store -> opcode() << ".\n"
+ << logofs_flush;
- HandleCleanup();
- }
+ HandleCleanup();
#endif
//
- // Never split the message if connected to
- // an old proxy version. Also refuse the
- // split if we it is not introduced by a
- // start split.
+ // Refuse the split if it is not introduced
+ // by a start split.
//
- if (control -> isProtoStep7() == 0)
- {
- #if defined(TEST) || defined(SPLIT)
- *logofs << "handleSplit: SPLIT! Ignoring the split with "
- << "an old proxy version.\n" << logofs_flush;
- #endif
-
- if (action == IS_ADDED || action == is_discarded)
- {
- encodeBuffer.encodeBoolValue(0);
- }
-
- return 0;
- }
- else if (splitState_.resource == nothing || enableSplit_ == 0)
+ // Since ProtoStep7 (#issue 108)
+ if (splitState_.resource == nothing || enableSplit_ == 0)
{
#if defined(TEST) || defined(SPLIT)
*logofs << "handleSplit: SPLIT! Nothing to do for message "
@@ -5875,16 +5667,7 @@ int ClientChannel::handleSplitEvent(DecodeBuffer &decodeBuffer)
<< strMsTimestamp() << ".\n" << logofs_flush;
#endif
- if (control -> isProtoStep7() == 0)
- {
- #ifdef PANIC
- *logofs << "handleSplitEvent: PANIC! The split can't "
- << "be aborted when connected to an old "
- << "proxy version.\n" << logofs_flush;
- #endif
-
- HandleCleanup();
- }
+ // Since ProtoStep7 (#issue 108)
//
// Decode the information about the
@@ -5999,7 +5782,7 @@ int ClientChannel::handleSplitEvent(DecodeBuffer &decodeBuffer)
#if defined(TEST) || defined(SPLIT)
*logofs << "handleSplitEvent: SPLIT! Spent "
- << diffTimestamp(startTs, getTimestamp()) << " Ms "
+ << diffTimestamp(startTs, getTimestamp()) << " ms "
<< "handling abort split events for FD#" << fd_
<< ".\n" << logofs_flush;
#endif
@@ -6512,146 +6295,6 @@ int ClientChannel::handleRestart(T_sequence_mode mode, int resource)
return 1;
}
-int ClientChannel::handleTaintCacheRequest(unsigned char &opcode, const unsigned char *&buffer,
- unsigned int &size)
-{
- #ifdef TEST
- *logofs << "handleTaintCacheRequest: Tainting cache request "
- << "for FD#" << fd_ << ".\n" << logofs_flush;
- #endif
-
- //
- // The save and load flags would affect
- // the decoding side but the decoding
- // side doesn't support the request.
- //
-
- enableCache_ = *(buffer + 4);
- enableSplit_ = *(buffer + 5);
-
- handleSplitEnable();
-
- #ifdef TEST
- *logofs << "handleTaintCacheRequest: Set cache parameters to "
- << "cache " << enableCache_ << " split " << enableSplit_
- << " load " << enableLoad_ << " save " << enableSave_
- << ".\n" << logofs_flush;
- #endif
-
- //
- // Taint the request to a X_NoOperation.
- //
-
- opcode = X_NoOperation;
-
- return 0;
-}
-
-int ClientChannel::handleTaintFontRequest(unsigned char &opcode, const unsigned char *&buffer,
- unsigned int &size)
-{
- //
- // The remote end doesn't support this
- // request so generate an empty reply
- // at the local side.
- //
-
- #ifdef TEST
- *logofs << "handleTaintFontRequest: Suppressing font "
- << "request for FD#" << fd_ << ".\n"
- << logofs_flush;
- #endif
-
- //
- // The client sequence number has not
- // been incremented yet in the loop.
- //
-
- unsigned int sequence = (clientSequence_ + 1) & 0xffff;
-
- #ifdef TEST
- *logofs << "handleTaintFontRequest: Opcode is " << (unsigned) opcode
- << " expected client sequence is " << sequence
- << ".\n" << logofs_flush;
- #endif
-
- unsigned char *reply = writeBuffer_.addMessage(36);
-
- *(reply + 0) = X_Reply;
-
- PutUINT(sequence, reply + 2, bigEndian_);
-
- PutULONG(1, reply + 4, bigEndian_);
-
- //
- // Set the length of the returned
- // path to 0.
- //
-
- *(reply + 32) = 0;
-
- //
- // Save the sequence number, not incremented
- // yet, we used to auto-generate this reply.
- //
-
- lastSequence_ = clientSequence_ + 1;
-
- #ifdef TEST
- *logofs << "handleTaintFontRequest: Registered " << lastSequence_
- << " as last auto-generated sequence number.\n"
- << logofs_flush;
- #endif
-
- //
- // Taint the request to a X_NoOperation.
- //
-
- opcode = X_NoOperation;
-
- if (handleFlush(flush_if_any) < 0)
- {
- return -1;
- }
-
- return 1;
-}
-
-int ClientChannel::handleTaintSplitRequest(unsigned char &opcode, const unsigned char *&buffer,
- unsigned int &size)
-{
- #ifdef TEST
-
- if (opcode == opcodeStore_ -> abortSplit)
- {
- *logofs << "handleTaintSplitRequest: Tainting abort split "
- << "request for FD#" << fd_ << ".\n"
- << logofs_flush;
- }
- else if (opcode == opcodeStore_ -> finishSplit)
- {
- *logofs << "handleTaintSplitRequest: Tainting finish split "
- << "request for FD#" << fd_ << ".\n"
- << logofs_flush;
- }
- else
- {
- *logofs << "handleTaintSplitRequest: Tainting free split "
- << "request for FD#" << fd_ << ".\n"
- << logofs_flush;
- }
-
- #endif
-
- //
- // Taint the request to a X_NoOperation.
- //
-
- opcode = X_NoOperation;
-
- return 1;
-}
-
int ClientChannel::handleTaintLameRequest(unsigned char &opcode, const unsigned char *&buffer,
unsigned int &size)
{
@@ -7485,12 +7128,12 @@ int ClientChannel::handleFastReadRequest(EncodeBuffer &encodeBuffer, const unsig
// All the NX requests are handled in the
// main message loop. The X_PutImage can
// be handled here only if the split was
- // not requested.
+ // not requested (since ProtoStep7 #issue 108).
//
if ((opcode >= X_NXFirstOpcode && opcode <= X_NXLastOpcode) ||
- (control -> isProtoStep7() == 1 && opcode == X_PutImage &&
- splitState_.resource != nothing) || opcode == X_ListExtensions ||
+ (opcode == X_PutImage && splitState_.resource != nothing) ||
+ opcode == X_ListExtensions ||
opcode == X_QueryExtension)
{
return 0;
@@ -7977,8 +7620,6 @@ int ClientChannel::handleCacheRequest(EncodeBuffer &encodeBuffer, const unsigned
enableSave_ = *(buffer + 6);
enableLoad_ = *(buffer + 7);
- handleSplitEnable();
-
#ifdef TEST
*logofs << "handleCacheRequest: Set cache parameters to "
<< " cache " << enableCache_ << " split " << enableSplit_
@@ -8068,11 +7709,9 @@ int ClientChannel::handleStartSplitRequest(EncodeBuffer &encodeBuffer, const uns
// Send the selected resource to the remote.
//
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeCachedValue(splitState_.resource, 8,
- clientCache_ -> resourceCache);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeCachedValue(splitState_.resource, 8,
+ clientCache_ -> resourceCache);
splitState_.mode = (T_split_mode) *(buffer + 4);
@@ -8157,11 +7796,9 @@ int ClientChannel::handleEndSplitRequest(EncodeBuffer &encodeBuffer, const unsig
// Send the selected resource to the remote.
//
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeCachedValue(splitState_.resource, 8,
- clientCache_ -> resourceCache);
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeCachedValue(splitState_.resource, 8,
+ clientCache_ -> resourceCache);
//
// Send the split notification events
@@ -8208,12 +7845,12 @@ void ClientChannel::handleDecodeCharInfo(DecodeBuffer &decodeBuffer, unsigned ch
for (unsigned int i = 1; i < 5; i++)
{
- unsigned int value;
+ unsigned int _value;
- decodeBuffer.decodeCachedValue(value, 16,
+ decodeBuffer.decodeCachedValue(_value, 16,
*serverCache_ -> queryFontCharInfoCache[i], 6);
- PutUINT(value, nextDest, bigEndian_);
+ PutUINT(_value, nextDest, bigEndian_);
nextDest += 2;
}
diff --git a/nxcomp/ClientChannel.h b/nxcomp/src/ClientChannel.h
index 9924bb263..ae92648d5 100644
--- a/nxcomp/ClientChannel.h
+++ b/nxcomp/src/ClientChannel.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ClientChannel_H
@@ -158,23 +166,6 @@ class ClientChannel : public Channel
int handleTaintRequest(unsigned char &opcode, const unsigned char *&buffer,
unsigned int &size)
{
- if (control -> isProtoStep7() == 0)
- {
- if (opcode == X_NXFreeSplit || opcode == X_NXAbortSplit ||
- opcode == X_NXFinishSplit)
- {
- return handleTaintSplitRequest(opcode, buffer, size);
- }
- else if (opcode == X_NXSetCacheParameters)
- {
- return handleTaintCacheRequest(opcode, buffer, size);
- }
- else if (opcode == X_NXGetFontParameters)
- {
- return handleTaintFontRequest(opcode, buffer, size);
- }
- }
-
if (control -> TaintReplies > 0 &&
opcode == X_GetInputFocus)
{
@@ -190,15 +181,6 @@ class ClientChannel : public Channel
return 0;
}
- int handleTaintCacheRequest(unsigned char &opcode, const unsigned char *&buffer,
- unsigned int &size);
-
- int handleTaintFontRequest(unsigned char &opcode, const unsigned char *&buffer,
- unsigned int &size);
-
- int handleTaintSplitRequest(unsigned char &opcode, const unsigned char *&buffer,
- unsigned int &size);
-
int handleTaintLameRequest(unsigned char &opcode, const unsigned char *&buffer,
unsigned int &size);
@@ -261,20 +243,6 @@ class ClientChannel : public Channel
int handleSplitChecksum(EncodeBuffer &encodeBuffer, T_checksum checksum);
- void handleSplitEnable()
- {
- if (control -> isProtoStep7() == 0)
- {
- #if defined(TEST) || defined(SPLIT)
- *logofs << "handleSplitEnable: WARNING! Disabling split "
- << "with an old proxy version.\n"
- << logofs_flush;
- #endif
-
- enableSplit_ = 0;
- }
- }
-
void handleSplitPending(int resource)
{
if (splitState_.pending == 0)
diff --git a/nxcomp/ClientProxy.cpp b/nxcomp/src/ClientProxy.cpp
index ef63bb0eb..3574d3bf3 100644
--- a/nxcomp/ClientProxy.cpp
+++ b/nxcomp/src/ClientProxy.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Socket.h"
#include "Agent.h"
@@ -68,8 +80,11 @@ void ClientProxy::handleDisplayConfiguration(const char *xServerDisplay, int xSe
#endif
}
-void ClientProxy::handlePortConfiguration(int cupsServerPort, int smbServerPort, int mediaServerPort,
- int httpServerPort, const char *fontServerPort)
+void ClientProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort,
+ ChannelEndPoint &smbServerPort,
+ ChannelEndPoint &mediaServerPort,
+ ChannelEndPoint &httpServerPort,
+ const char *fontServerPort)
{
delete [] fontServerPort_;
@@ -141,8 +156,8 @@ int ClientProxy::handleNewConnectionFromProxy(T_channel_type type, int channelId
// Connect on the TCP port number.
//
- return handleNewGenericConnectionFromProxy(channelId, channel_font, "localhost",
- port, "font");
+ return handleNewGenericConnectionFromProxyTCP(channelId, channel_font, "localhost",
+ port, "font");
}
else
{
@@ -150,7 +165,7 @@ int ClientProxy::handleNewConnectionFromProxy(T_channel_type type, int channelId
// Connect to the Unix path.
//
- return handleNewGenericConnectionFromProxy(channelId, channel_font, "localhost",
+ return handleNewGenericConnectionFromProxyUnix(channelId, channel_font,
fontServerPort_, "font");
}
}
@@ -182,11 +197,11 @@ int ClientProxy::handleNewAgentConnection(Agent *agent)
if (channelId == -1)
{
#ifdef PANIC
- *logofs << "ClientProxy: PANIC! Maximum mumber of available "
+ *logofs << "ClientProxy: PANIC! Maximum number of available "
<< "channels exceeded.\n" << logofs_flush;
#endif
- cerr << "Error" << ": Maximum mumber of available "
+ cerr << "Error" << ": Maximum number of available "
<< "channels exceeded.\n";
return -1;
@@ -215,11 +230,11 @@ int ClientProxy::handleNewXConnection(int clientFd)
if (channelId == -1)
{
#ifdef PANIC
- *logofs << "ClientProxy: PANIC! Maximum mumber of available "
+ *logofs << "ClientProxy: PANIC! Maximum number of available "
<< "channels exceeded.\n" << logofs_flush;
#endif
- cerr << "Error" << ": Maximum mumber of available "
+ cerr << "Error" << ": Maximum number of available "
<< "channels exceeded.\n";
return -1;
diff --git a/nxcomp/ClientProxy.h b/nxcomp/src/ClientProxy.h
index 2b669ba2d..b89785b1a 100644
--- a/nxcomp/ClientProxy.h
+++ b/nxcomp/src/ClientProxy.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ClientProxy_H
@@ -38,8 +46,11 @@ class ClientProxy : public Proxy
virtual void handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily,
sockaddr *xServerAddr, unsigned int xServerAddrLength);
- virtual void handlePortConfiguration(int cupsServerPort, int smbServerPort, int mediaServerPort,
- int httpServerPort, const char *fontServerPort);
+ virtual void handlePortConfiguration(ChannelEndPoint &cupsServerPort,
+ ChannelEndPoint &smbServerPort,
+ ChannelEndPoint &mediaServerPort,
+ ChannelEndPoint &httpServerPort,
+ const char *fontServerPort);
protected:
@@ -84,14 +95,8 @@ class ClientProxy : public Proxy
virtual int checkLocalChannelMap(int channelId)
{
- if (control -> isProtoStep7() == 1)
- {
- return ((channelId & control -> ChannelMask) != 0);
- }
- else
- {
- return 1;
- }
+ // Since ProtoStep7 (#issue 108)
+ return ((channelId & control -> ChannelMask) != 0);
}
//
diff --git a/nxcomp/ClientReadBuffer.cpp b/nxcomp/src/ClientReadBuffer.cpp
index b32033b17..c8f4f69a4 100644
--- a/nxcomp/ClientReadBuffer.cpp
+++ b/nxcomp/src/ClientReadBuffer.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ClientReadBuffer.h"
#include "ClientChannel.h"
@@ -29,7 +41,7 @@ unsigned int ClientReadBuffer::suggestedLength(unsigned int pendingLength)
//
// Even if the pending data is not
// enough to make a complete message,
- // resize the buffer to accomodate
+ // resize the buffer to accommodate
// it all.
//
diff --git a/nxcomp/ClientReadBuffer.h b/nxcomp/src/ClientReadBuffer.h
index 6dee630ac..c557417fa 100644
--- a/nxcomp/ClientReadBuffer.h
+++ b/nxcomp/src/ClientReadBuffer.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ClientReadBuffer_H
diff --git a/nxcomp/ClientStore.cpp b/nxcomp/src/ClientStore.cpp
index be0e892b4..0c12eefd8 100644
--- a/nxcomp/ClientStore.cpp
+++ b/nxcomp/src/ClientStore.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ClientStore.h"
//
@@ -54,11 +66,6 @@
#include "PutPackedImage.h"
#include "GenericRequest.h"
-#include "ChangeGCCompat.h"
-#include "CreatePixmapCompat.h"
-#include "SetUnpackColormapCompat.h"
-#include "SetUnpackAlphaCompat.h"
-
//
// Set the verbosity level.
//
@@ -111,20 +118,11 @@ ClientStore::ClientStore(StaticCompressor *compressor)
requests_[X_NXSetUnpackGeometry] = new SetUnpackGeometryStore(compressor);
requests_[X_NXPutPackedImage] = new PutPackedImageStore(compressor);
- if (control -> isProtoStep7() == 1)
- {
- requests_[X_ChangeGC] = new ChangeGCStore();
- requests_[X_CreatePixmap] = new CreatePixmapStore();
- requests_[X_NXSetUnpackColormap] = new SetUnpackColormapStore(compressor);
- requests_[X_NXSetUnpackAlpha] = new SetUnpackAlphaStore(compressor);
- }
- else
- {
- requests_[X_ChangeGC] = new ChangeGCCompatStore();
- requests_[X_CreatePixmap] = new CreatePixmapCompatStore();
- requests_[X_NXSetUnpackColormap] = new SetUnpackColormapCompatStore(compressor);
- requests_[X_NXSetUnpackAlpha] = new SetUnpackAlphaCompatStore(compressor);
- }
+ // Since ProtoStep7 (#issue 108)
+ requests_[X_ChangeGC] = new ChangeGCStore();
+ requests_[X_CreatePixmap] = new CreatePixmapStore();
+ requests_[X_NXSetUnpackColormap] = new SetUnpackColormapStore(compressor);
+ requests_[X_NXSetUnpackAlpha] = new SetUnpackAlphaStore(compressor);
for (int i = 0; i < CHANNEL_STORE_RESOURCE_LIMIT; i++)
{
diff --git a/nxcomp/ClientStore.h b/nxcomp/src/ClientStore.h
index 54a68a309..009d87d9f 100644
--- a/nxcomp/ClientStore.h
+++ b/nxcomp/src/ClientStore.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ClientStore_H
diff --git a/nxcomp/Colormap.cpp b/nxcomp/src/Colormap.cpp
index 5702beca9..afe99ecae 100644
--- a/nxcomp/Colormap.cpp
+++ b/nxcomp/src/Colormap.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Misc.h"
#include "Unpack.h"
#include "Colormap.h"
diff --git a/nxcomp/src/Colormap.h b/nxcomp/src/Colormap.h
new file mode 100644
index 000000000..a96d003fa
--- /dev/null
+++ b/nxcomp/src/Colormap.h
@@ -0,0 +1,32 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
+/* */
+/* NXCOMP, NX protocol compression and NX extensions to this software */
+/* are copyright of the aforementioned persons and companies. */
+/* */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
+/* */
+/* All rights reserved. */
+/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
+/**************************************************************************/
+
+#ifndef Colormap_H
+#define Colormap_H
+
+int UnpackColormap(unsigned char method, unsigned char *src_data, int src_size,
+ unsigned char *dst_data, int dst_size);
+
+#endif /* Colormap_H */
diff --git a/nxcomp/ConfigureWindow.cpp b/nxcomp/src/ConfigureWindow.cpp
index 995ab1831..32d3153b9 100644
--- a/nxcomp/ConfigureWindow.cpp
+++ b/nxcomp/src/ConfigureWindow.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ConfigureWindow.h"
#include "ClientCache.h"
diff --git a/nxcomp/ConfigureWindow.h b/nxcomp/src/ConfigureWindow.h
index bb511b0d4..e02c2aae1 100644
--- a/nxcomp/ConfigureWindow.h
+++ b/nxcomp/src/ConfigureWindow.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ConfigureWindow_H
diff --git a/nxcomp/Control.cpp b/nxcomp/src/Control.cpp
index ce99567d7..75fd56e3f 100644
--- a/nxcomp/Control.cpp
+++ b/nxcomp/src/Control.cpp
@@ -1,20 +1,33 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "NX.h"
#include "NXpack.h"
#include "Control.h"
@@ -348,6 +361,14 @@
#define FILE_SIZE_CHECK_TIMEOUT 60000
//
+// Protocol version compatibility values
+//
+
+const int Control::NX_MIN_PROTO_STEP = 10;
+const int Control::NX_MAX_PROTO_STEP = 10;
+const char* const Control::NXPROXY_COMPATIBILITY_VERSION = "3.5.0";
+
+//
// Set defaults for control. They should be what
// you get in case of 'local' connection.
//
@@ -594,49 +615,23 @@ Control::Control()
RemoteVersionMajor = -1;
RemoteVersionMinor = -1;
RemoteVersionPatch = -1;
+ RemoteVersionMaintenancePatch = -1;
CompatVersionMajor = -1;
CompatVersionMinor = -1;
CompatVersionPatch = -1;
+ CompatVersionMaintenancePatch = -1;
- char version[32];
-
- strcpy(version, VERSION);
-
- char *value;
-
- value = strtok(version, ".");
-
- for (int i = 0; value != NULL && i < 3; i++)
- {
- switch (i)
- {
- case 0:
-
- LocalVersionMajor = atoi(value);
-
- break;
-
- case 1:
-
- LocalVersionMinor = atoi(value);
-
- break;
-
- case 2:
-
- LocalVersionPatch = atoi(value);
-
- break;
- }
-
- value = strtok(NULL, ".");
- }
+ LocalVersionMajor = NXMajorVersion();
+ LocalVersionMinor = NXMinorVersion();
+ LocalVersionPatch = NXPatchVersion();
+ LocalVersionMaintenancePatch = NXMaintenancePatchVersion();
#ifdef TEST
*logofs << "Control: Major version is " << LocalVersionMajor
<< " minor is " << LocalVersionMinor << " patch is "
- << LocalVersionPatch << ".\n" << logofs_flush;
+ << LocalVersionPatch << " Maintenance version is "
+ << LocalVersionMaintenancePatch << ".\n" << logofs_flush;
#endif
//
@@ -659,11 +654,7 @@ Control::Control()
// time the session is negotiated.
//
- protoStep6_ = 0;
- protoStep7_ = 0;
- protoStep8_ = 0;
- protoStep9_ = 0;
- protoStep10_ = 0;
+ protoStep_ = 0;
}
Control::~Control()
@@ -731,92 +722,27 @@ Control::~Control()
void Control::setProtoStep(int step)
{
- switch (step)
+ if (isValidProtoStep(step))
{
- case 6:
- {
- protoStep6_ = 1;
- protoStep7_ = 0;
- protoStep8_ = 0;
- protoStep9_ = 0;
- protoStep10_ = 0;
-
- break;
- }
- case 7:
- {
- protoStep6_ = 1;
- protoStep7_ = 1;
- protoStep8_ = 0;
- protoStep9_ = 0;
- protoStep10_ = 0;
-
- break;
- }
- case 8:
- {
- protoStep6_ = 1;
- protoStep7_ = 1;
- protoStep8_ = 1;
- protoStep9_ = 0;
- protoStep10_ = 0;
-
- break;
- }
- case 9:
- {
- protoStep6_ = 1;
- protoStep7_ = 1;
- protoStep8_ = 1;
- protoStep9_ = 1;
- protoStep10_ = 0;
-
- break;
- }
- case 10:
- {
- protoStep6_ = 1;
- protoStep7_ = 1;
- protoStep8_ = 1;
- protoStep9_ = 1;
- protoStep10_ = 1;
-
- break;
- }
- default:
- {
- #ifdef PANIC
- *logofs << "Control: PANIC! Invalid protocol step "
- << "with value " << step << ".\n"
- << logofs_flush;
- #endif
-
- HandleCleanup();
- }
+ protoStep_ = step;
+ }
+ else
+ {
+ #ifdef PANIC
+ *logofs << "Control: PANIC! Invalid protocol step "
+ << "with value " << step << ".\n"
+ << logofs_flush;
+ #endif
+
+ HandleCleanup();
}
}
int Control::getProtoStep()
{
- if (protoStep10_ == 1)
- {
- return 10;
- }
- else if (protoStep9_ == 1)
- {
- return 9;
- }
- else if (protoStep8_ == 1)
- {
- return 8;
- }
- else if (protoStep7_ == 1)
- {
- return 7;
- }
- else if (protoStep6_ == 1)
+ if (isValidProtoStep(protoStep_))
{
- return 6;
+ return protoStep_;
}
else
{
diff --git a/nxcomp/Control.h b/nxcomp/src/Control.h
index c21477544..764fca2c1 100644
--- a/nxcomp/Control.h
+++ b/nxcomp/src/Control.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Control_H
@@ -299,17 +307,32 @@ class Control
// Version number of local and remote proxy.
//
+ /*
+ * LocalVersionMaintenancePatch, RemoteVersionMaintenancePatch
+ * CompatVersionMaintenancePatch
+ *
+ * currently not used, for future compatibility checks
+ */
int LocalVersionMajor;
int LocalVersionMinor;
int LocalVersionPatch;
+ int LocalVersionMaintenancePatch;
int RemoteVersionMajor;
int RemoteVersionMinor;
int RemoteVersionPatch;
+ int RemoteVersionMaintenancePatch;
int CompatVersionMajor;
int CompatVersionMinor;
int CompatVersionPatch;
+ int CompatVersionMaintenancePatch;
+
+ //
+ // Compatibility version for the proxy
+ //
+
+ static const char* const NXPROXY_COMPATIBILITY_VERSION;
//
// Which unpack methods are implemented in proxy?
@@ -704,26 +727,6 @@ class Control
int getProtoStep();
- int isProtoStep7()
- {
- return protoStep7_;
- }
-
- int isProtoStep8()
- {
- return protoStep8_;
- }
-
- int isProtoStep9()
- {
- return protoStep9_;
- }
-
- int isProtoStep10()
- {
- return protoStep10_;
- }
-
private:
//
@@ -737,11 +740,25 @@ class Control
// to the protocol version.
//
- int protoStep6_;
- int protoStep7_;
- int protoStep8_;
- int protoStep9_;
- int protoStep10_;
+ int protoStep_;
+
+ //
+ // Min and max values allowed for protocol step
+ // depending on protocol version compatibility
+ //
+
+ static const int NX_MIN_PROTO_STEP;
+ static const int NX_MAX_PROTO_STEP;
+
+ //
+ // Check the validity of protocol step
+ //
+
+ bool isValidProtoStep(int step)
+ {
+ return ((step >= NX_MIN_PROTO_STEP) && (step <= NX_MAX_PROTO_STEP));
+ }
+
};
#endif /* Control_H */
diff --git a/nxcomp/CopyArea.cpp b/nxcomp/src/CopyArea.cpp
index e384ce13c..c2a19c2df 100644
--- a/nxcomp/CopyArea.cpp
+++ b/nxcomp/src/CopyArea.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "CopyArea.h"
#include "ClientCache.h"
diff --git a/nxcomp/CopyArea.h b/nxcomp/src/CopyArea.h
index a811f3801..6b2617875 100644
--- a/nxcomp/CopyArea.h
+++ b/nxcomp/src/CopyArea.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef CopyArea_H
diff --git a/nxcomp/CreateGC.cpp b/nxcomp/src/CreateGC.cpp
index f1c10e69b..34978de13 100644
--- a/nxcomp/CreateGC.cpp
+++ b/nxcomp/src/CreateGC.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "CreateGC.h"
#include "ClientCache.h"
@@ -146,39 +158,17 @@ void CreateGCStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *me
ClientCache *clientCache = (ClientCache *) channelCache;
- if (control -> isProtoStep7() == 1)
- {
- #ifdef TEST
- *logofs << name() << ": Encoding value " << createGC -> gcontext
- << " as gcontext field.\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeNewXidValue(createGC -> gcontext, clientCache -> lastId,
- clientCache -> lastIdCache, clientCache -> gcCache,
- clientCache -> freeGCCache);
-
- cachedCreateGC -> gcontext = createGC -> gcontext;
- }
- else
- {
- #ifdef TEST
- *logofs << name() << ": Encoding value " << createGC -> drawable
- << " as drawable field.\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeXidValue(createGC -> drawable, clientCache -> drawableCache);
-
- cachedCreateGC -> drawable = createGC -> drawable;
-
- #ifdef TEST
- *logofs << name() << ": Encoding value " << createGC -> gcontext
- << " as gcontext field.\n" << logofs_flush;
- #endif
+ // Since ProtoStep7 (#issue 108)
+ #ifdef TEST
+ *logofs << name() << ": Encoding value " << createGC -> gcontext
+ << " as gcontext field.\n" << logofs_flush;
+ #endif
- encodeBuffer.encodeXidValue(createGC -> gcontext, clientCache -> gcCache);
+ encodeBuffer.encodeNewXidValue(createGC -> gcontext, clientCache -> lastId,
+ clientCache -> lastIdCache, clientCache -> gcCache,
+ clientCache -> freeGCCache);
- cachedCreateGC -> gcontext = createGC -> gcontext;
- }
+ cachedCreateGC -> gcontext = createGC -> gcontext;
}
void CreateGCStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message,
@@ -190,37 +180,15 @@ void CreateGCStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *me
unsigned int value;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeNewXidValue(value, clientCache -> lastId,
- clientCache -> lastIdCache, clientCache -> gcCache,
- clientCache -> freeGCCache);
-
- createGC -> gcontext = value;
-
- #ifdef TEST
- *logofs << name() << ": Decoded value " << createGC -> gcontext
- << " as gcontext field.\n" << logofs_flush;
- #endif
- }
- else
- {
- decodeBuffer.decodeXidValue(value, clientCache -> drawableCache);
-
- createGC -> drawable = value;
-
- #ifdef TEST
- *logofs << name() << ": Decoded value " << createGC -> drawable
- << " as drawable field.\n" << logofs_flush;
- #endif
-
- decodeBuffer.decodeXidValue(value, clientCache -> gcCache);
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeNewXidValue(value, clientCache -> lastId,
+ clientCache -> lastIdCache, clientCache -> gcCache,
+ clientCache -> freeGCCache);
- createGC -> gcontext = value;
+ createGC -> gcontext = value;
- #ifdef TEST
- *logofs << name() << ": Decoded value " << createGC -> gcontext
- << " as gcontext field.\n" << logofs_flush;
- #endif
- }
+ #ifdef TEST
+ *logofs << name() << ": Decoded value " << createGC -> gcontext
+ << " as gcontext field.\n" << logofs_flush;
+ #endif
}
diff --git a/nxcomp/CreateGC.h b/nxcomp/src/CreateGC.h
index b77f13c47..03e27d685 100644
--- a/nxcomp/CreateGC.h
+++ b/nxcomp/src/CreateGC.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef CreateGC_H
diff --git a/nxcomp/CreatePixmap.cpp b/nxcomp/src/CreatePixmap.cpp
index 403786747..a60134cd5 100644
--- a/nxcomp/CreatePixmap.cpp
+++ b/nxcomp/src/CreatePixmap.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "CreatePixmap.h"
#include "ClientCache.h"
diff --git a/nxcomp/CreatePixmap.h b/nxcomp/src/CreatePixmap.h
index 1d742e452..0a3212dd9 100644
--- a/nxcomp/CreatePixmap.h
+++ b/nxcomp/src/CreatePixmap.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef CreatePixmap_H
diff --git a/nxcomp/DecodeBuffer.cpp b/nxcomp/src/DecodeBuffer.cpp
index 077bfdfc0..4c1530d9b 100644
--- a/nxcomp/DecodeBuffer.cpp
+++ b/nxcomp/src/DecodeBuffer.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Misc.h"
#include "Control.h"
@@ -34,10 +46,8 @@ DecodeBuffer::DecodeBuffer(const unsigned char *data, unsigned int length)
: buffer_(data), end_(buffer_ + length), nextSrc_(buffer_), srcMask_(0x80)
{
- if (control -> isProtoStep7() == 1)
- {
- end_ = buffer_ + length - DECODE_BUFFER_POSTFIX_SIZE;
- }
+ // Since ProtoStep7 (#issue 108)
+ end_ = buffer_ + length - DECODE_BUFFER_POSTFIX_SIZE;
}
int DecodeBuffer::decodeValue(unsigned int &value, unsigned int numBits,
@@ -277,63 +287,25 @@ int DecodeBuffer::decodeCachedValue(unsigned int &value, unsigned int numBits,
if (index == 2)
{
- if (control -> isProtoStep8() == 1)
- {
- blockSize = cache.getBlockSize(blockSize);
-
- if (decodeValue(value, numBits, blockSize, endOkay))
- {
- cache.insert(value, IntMask[numBits]);
-
- return 1;
- }
-
- #ifdef PANIC
- *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [H] "
- << "in decodeCacheValue() with no value found.\n"
- << logofs_flush;
- #endif
+ // Since ProtoStep8 (#issue 108)
+ blockSize = cache.getBlockSize(blockSize);
- cerr << "Error" << ": Failure decoding data in context [H].\n";
-
- HandleAbort();
- }
- else
+ if (decodeValue(value, numBits, blockSize, endOkay))
{
- unsigned int sameDiff;
-
- decodeBoolValue(sameDiff);
-
- if (sameDiff)
- {
- value = cache.getLastDiff(IntMask[numBits]);
+ cache.insert(value, IntMask[numBits]);
- cache.insert(value, IntMask[numBits]);
-
- return 1;
- }
- else
- {
- blockSize = cache.getBlockSize(blockSize);
-
- if (decodeValue(value, numBits, blockSize, endOkay))
- {
- cache.insert(value, IntMask[numBits]);
-
- return 1;
- }
+ return 1;
+ }
- #ifdef PANIC
- *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [H] "
- << "in decodeCacheValue() with no value found.\n"
- << logofs_flush;
- #endif
+ #ifdef PANIC
+ *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [H] "
+ << "in decodeCacheValue() with no value found.\n"
+ << logofs_flush;
+ #endif
- cerr << "Error" << ": Failure decoding data in context [H].\n";
+ cerr << "Error" << ": Failure decoding data in context [H].\n";
- HandleAbort();
- }
- }
+ HandleAbort();
}
else
{
@@ -665,28 +637,3 @@ void DecodeBuffer::decodeFreeXidValue(unsigned int &value, FreeCache &cache)
decodeCachedValue(value, 29, cache);
}
-void DecodeBuffer::decodePositionValueCompat(short int &value, PositionCacheCompat &cache)
-{
- unsigned int t;
-
- decodeCachedValue(t, 13, *(cache.base_[cache.slot_]));
-
- cache.last_ += t;
- cache.last_ &= 0x1fff;
-
- value = cache.last_;
-
- #ifdef DEBUG
- *logofs << "DecodeBuffer: Decoded position "
- << value << " with base " << cache.slot_
- << ".\n" << logofs_flush;
- #endif
-
- #ifdef DEBUG
- *logofs << "DecodeBuffer: Position block prediction is "
- << (*(cache.base_[cache.slot_])).getBlockSize(13)
- << ".\n" << logofs_flush;
- #endif
-
- cache.slot_ = (value & 0x1f);
-}
diff --git a/nxcomp/DecodeBuffer.h b/nxcomp/src/DecodeBuffer.h
index 9345f4e23..f5f84c54f 100644
--- a/nxcomp/DecodeBuffer.h
+++ b/nxcomp/src/DecodeBuffer.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef DecodeBuffer_H
@@ -27,9 +35,6 @@
#include "OpcodeCache.h"
#include "ActionCache.h"
-#include "ActionCacheCompat.h"
-#include "PositionCacheCompat.h"
-
#define DECODE_BUFFER_OVERFLOW_SIZE 4194304
#define DECODE_BUFFER_POSTFIX_SIZE 1
@@ -99,15 +104,6 @@ class DecodeBuffer
void decodeFreeXidValue(unsigned int &value, FreeCache &cache);
- void decodeActionValueCompat(unsigned char &value, ActionCacheCompat &cache)
- {
- decodeCachedValue(value, 2, cache.base_[cache.slot_]);
-
- cache.slot_ = value;
- }
-
- void decodePositionValueCompat(short int &value, PositionCacheCompat &cache);
-
void decodeTextData(unsigned char *buffer, unsigned int numBytes)
{
decodeMemory(buffer, numBytes);
diff --git a/nxcomp/EncodeBuffer.cpp b/nxcomp/src/EncodeBuffer.cpp
index 466a1d7a0..e112113a8 100644
--- a/nxcomp/EncodeBuffer.cpp
+++ b/nxcomp/src/EncodeBuffer.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Misc.h"
#include "Control.h"
@@ -261,47 +273,14 @@ void EncodeBuffer::encodeCachedValue(unsigned int value, unsigned int numBits,
// Avoid to encode the additional bool.
//
- if (control -> isProtoStep8() == 1)
- {
- #ifdef DUMP
- *logofs << "EncodeBuffer: Encoded missed int using "
- << diffBits() << " bits out of " << numBits
- << ".\n" << logofs_flush;
- #endif
-
- encodeValue(value, numBits, blockSize);
- }
- else
- {
- if (sameDiff)
- {
- #ifdef DUMP
- *logofs << "EncodeBuffer: Matched difference with block size "
- << cache.getBlockSize(blockSize) << ".\n"
- << logofs_flush;
- #endif
-
- encodeBoolValue(1);
- }
- else
- {
- #ifdef DUMP
- *logofs << "EncodeBuffer: Missed difference with block size "
- << cache.getBlockSize(blockSize) << ".\n"
- << logofs_flush;
- #endif
-
- encodeBoolValue(0);
-
- encodeValue(value, numBits, blockSize);
- }
+ // Since ProtoStep8 (#issue 108)
+ #ifdef DUMP
+ *logofs << "EncodeBuffer: Encoded missed int using "
+ << diffBits() << " bits out of " << numBits
+ << ".\n" << logofs_flush;
+ #endif
- #ifdef DUMP
- *logofs << "EncodeBuffer: Encoded missed int using "
- << diffBits() << " bits out of " << numBits
- << ".\n" << logofs_flush;
- #endif
- }
+ encodeValue(value, numBits, blockSize);
}
}
@@ -454,7 +433,8 @@ unsigned int EncodeBuffer::getLength() const
length++;
}
- if (length > 0 && control -> isProtoStep7() == 1)
+ // Since ProtoStep7 (#issue 108)
+ if (length > 0)
{
return length + ENCODE_BUFFER_POSTFIX_SIZE;
}
@@ -505,12 +485,12 @@ void EncodeBuffer::growBuffer(unsigned int numBytes)
{
#ifdef PANIC
*logofs << "EncodeBuffer: PANIC! Error in context [C] "
- << "growing buffer to accomodate " << numBytes
+ << "growing buffer to accommodate " << numBytes
<< " bytes .\n" << logofs_flush;
#endif
cerr << "Error" << ": Error in context [C] "
- << "growing encode buffer to accomodate "
+ << "growing encode buffer to accommodate "
<< numBytes << " bytes.\n";
HandleAbort();
@@ -641,20 +621,3 @@ void EncodeBuffer::encodeFreeXidValue(unsigned int value, FreeCache &cache)
{
encodeCachedValue(value, 29, cache);
}
-
-void EncodeBuffer::encodePositionValueCompat(short int value, PositionCacheCompat &cache)
-{
- unsigned int t = (value - cache.last_);
-
- encodeCachedValue(t, 13, *(cache.base_[cache.slot_]));
-
- cache.last_ = value;
-
- #ifdef DEBUG
- *logofs << "EncodeBuffer: Encoded position "
- << value << " with base " << cache.slot_
- << ".\n" << logofs_flush;
- #endif
-
- cache.slot_ = (value & 0x1f);
-}
diff --git a/nxcomp/EncodeBuffer.h b/nxcomp/src/EncodeBuffer.h
index 9f5ac5352..67f6ff093 100644
--- a/nxcomp/EncodeBuffer.h
+++ b/nxcomp/src/EncodeBuffer.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef EncodeBuffer_H
@@ -25,9 +33,6 @@
#include "OpcodeCache.h"
#include "ActionCache.h"
-#include "ActionCacheCompat.h"
-#include "PositionCacheCompat.h"
-
#define ENCODE_BUFFER_DEFAULT_SIZE 16384
//
@@ -117,15 +122,6 @@ class EncodeBuffer
void encodeFreeXidValue(unsigned int value, FreeCache &cache);
- void encodeActionValueCompat(unsigned char value, ActionCacheCompat &cache)
- {
- encodeCachedValue(value, 2, cache.base_[cache.slot_]);
-
- cache.slot_ = value;
- }
-
- void encodePositionValueCompat(short int value, PositionCacheCompat &cache);
-
void encodeTextData(const unsigned char *buffer, unsigned int numBytes)
{
encodeMemory(buffer, numBytes);
diff --git a/nxcomp/FillPoly.cpp b/nxcomp/src/FillPoly.cpp
index 37df3772b..b5928d5cf 100644
--- a/nxcomp/FillPoly.cpp
+++ b/nxcomp/src/FillPoly.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "FillPoly.h"
#include "ClientCache.h"
@@ -51,8 +63,8 @@ int FillPolyStore::parseIdentity(Message *message, const unsigned char *buffer,
fillPoly -> shape = *(buffer + 12);
fillPoly -> mode = *(buffer + 13);
- if (control -> isProtoStep8() == 1 &&
- size >= (unsigned int) dataOffset)
+ // Since ProtoStep8 (#issue 108)
+ if (size >= (unsigned int) dataOffset)
{
fillPoly -> x_origin = GetUINT(buffer + 16, bigEndian);
fillPoly -> y_origin = GetUINT(buffer + 18, bigEndian);
@@ -85,8 +97,8 @@ int FillPolyStore::unparseIdentity(const Message *message, unsigned char *buffer
*(buffer + 12) = fillPoly -> shape;
*(buffer + 13) = fillPoly -> mode;
- if (control -> isProtoStep8() == 1 &&
- size >= (unsigned int) dataOffset)
+ // Since ProtoStep8 (#issue 108)
+ if (size >= (unsigned int) dataOffset)
{
PutUINT(fillPoly -> x_origin, buffer + 16, bigEndian);
PutUINT(fillPoly -> y_origin, buffer + 18, bigEndian);
@@ -151,8 +163,8 @@ void FillPolyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *me
cachedFillPoly -> gcontext = fillPoly -> gcontext;
- if (control -> isProtoStep8() == 1 &&
- fillPoly -> size_ >= dataOffset)
+ // Since ProtoStep8 (#issue 108)
+ if (fillPoly -> size_ >= dataOffset)
{
#ifdef TEST
*logofs << name() << ": Encoding value " << fillPoly -> x_origin
@@ -197,8 +209,8 @@ void FillPolyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *me
<< " as gcontext field.\n" << logofs_flush;
#endif
- if (control -> isProtoStep8() == 1 &&
- fillPoly -> size_ >= dataOffset)
+ // Since ProtoStep8 (#issue 108)
+ if (fillPoly -> size_ >= dataOffset)
{
unsigned int value;
diff --git a/nxcomp/FillPoly.h b/nxcomp/src/FillPoly.h
index f33968494..4ceb96c09 100644
--- a/nxcomp/FillPoly.h
+++ b/nxcomp/src/FillPoly.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef FillPoly_H
@@ -40,7 +48,6 @@
#define FILLPOLY_ENABLE_COMPRESS 0
#define FILLPOLY_DATA_LIMIT 512
-#define FILLPOLY_DATA_OFFSET 16
#define FILLPOLY_CACHE_SLOTS 2000
#define FILLPOLY_CACHE_THRESHOLD 3
@@ -98,12 +105,9 @@ class FillPolyStore : public MessageStore
enableCompress = FILLPOLY_ENABLE_COMPRESS;
dataLimit = FILLPOLY_DATA_LIMIT;
- dataOffset = FILLPOLY_DATA_OFFSET;
- if (control -> isProtoStep8() == 1)
- {
- dataOffset = FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8;
- }
+ // Since ProtoStep8 (#issue 108)
+ dataOffset = FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8;
cacheSlots = FILLPOLY_CACHE_SLOTS;
cacheThreshold = FILLPOLY_CACHE_THRESHOLD;
@@ -169,11 +173,9 @@ class FillPolyStore : public MessageStore
virtual int identitySize(const unsigned char *buffer, unsigned int size)
{
- unsigned int offset = (control -> isProtoStep8() == 1 ?
- FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8 :
- FILLPOLY_DATA_OFFSET);
-
- return (size >= offset ? offset : size);
+ // Since ProtoStep8 (#issue 108)
+ return (size >= FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8 ?
+ FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8 : size);
}
virtual int parseIdentity(Message *message, const unsigned char *buffer,
diff --git a/nxcomp/Fork.cpp b/nxcomp/src/Fork.cpp
index 48faa2992..657c36134 100644
--- a/nxcomp/Fork.cpp
+++ b/nxcomp/src/Fork.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <unistd.h>
#include "Fork.h"
diff --git a/nxcomp/src/Fork.h b/nxcomp/src/Fork.h
new file mode 100644
index 000000000..94238ed90
--- /dev/null
+++ b/nxcomp/src/Fork.h
@@ -0,0 +1,31 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
+/* */
+/* NXCOMP, NX protocol compression and NX extensions to this software */
+/* are copyright of the aforementioned persons and companies. */
+/* */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
+/* */
+/* All rights reserved. */
+/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
+/**************************************************************************/
+
+//
+// Try again if the fork() fails, as it can happen
+// often on Cygwin.
+//
+
+extern int Fork();
diff --git a/nxcomp/src/FreeCache.h b/nxcomp/src/FreeCache.h
new file mode 100644
index 000000000..bf5c801e5
--- /dev/null
+++ b/nxcomp/src/FreeCache.h
@@ -0,0 +1,42 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
+/* */
+/* NXCOMP, NX protocol compression and NX extensions to this software */
+/* are copyright of the aforementioned persons and companies. */
+/* */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
+/* */
+/* All rights reserved. */
+/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
+/**************************************************************************/
+
+#ifndef FreeCache_H
+#define FreeCache_H
+
+#include "IntCache.h"
+
+class FreeCache : public IntCache
+{
+ public:
+
+ FreeCache(unsigned int size)
+
+ : IntCache(size)
+ {
+ }
+};
+
+#endif /* FreeCache_H */
diff --git a/nxcomp/GenericChannel.cpp b/nxcomp/src/GenericChannel.cpp
index 641ad36d4..877412cee 100644
--- a/nxcomp/GenericChannel.cpp
+++ b/nxcomp/src/GenericChannel.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <sys/types.h>
#include <sys/socket.h>
@@ -210,7 +222,7 @@ int GenericChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *
// All data has been read from the read buffer.
// We still need to mark the end of the encode
// buffer just before sending the frame. This
- // allows us to accomodate multiple reads in
+ // allows us to accommodate multiple reads in
// a single frame.
//
diff --git a/nxcomp/GenericChannel.h b/nxcomp/src/GenericChannel.h
index ba4f1e7e8..3df18f444 100644
--- a/nxcomp/GenericChannel.h
+++ b/nxcomp/src/GenericChannel.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef GenericChannel_H
@@ -209,11 +217,7 @@ class CupsChannel : public GenericChannel
virtual int isCompressed()
{
- if (control -> isProtoStep8() == 0)
- {
- return 1;
- }
-
+ // Since ProtoStep8 (#issue 108)
return 0;
}
@@ -252,11 +256,7 @@ class SmbChannel : public GenericChannel
virtual int isCompressed()
{
- if (control -> isProtoStep8() == 0)
- {
- return 1;
- }
-
+ // Since ProtoStep8 (#issue 108)
return 0;
}
@@ -344,11 +344,7 @@ class HttpChannel : public GenericChannel
virtual int isCompressed()
{
- if (control -> isProtoStep8() == 0)
- {
- return 1;
- }
-
+ // Since ProtoStep8 (#issue 108)
return 0;
}
@@ -387,11 +383,7 @@ class FontChannel : public GenericChannel
virtual int isCompressed()
{
- if (control -> isProtoStep8() == 0)
- {
- return 1;
- }
-
+ // Since ProtoStep8 (#issue 108)
return 0;
}
diff --git a/nxcomp/GenericReadBuffer.cpp b/nxcomp/src/GenericReadBuffer.cpp
index b7b6d93f4..78217157e 100644
--- a/nxcomp/GenericReadBuffer.cpp
+++ b/nxcomp/src/GenericReadBuffer.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "GenericReadBuffer.h"
#include "GenericChannel.h"
diff --git a/nxcomp/GenericReadBuffer.h b/nxcomp/src/GenericReadBuffer.h
index 6b1fdd1fa..5ea4d939d 100644
--- a/nxcomp/GenericReadBuffer.h
+++ b/nxcomp/src/GenericReadBuffer.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef GenericReadBuffer_H
diff --git a/nxcomp/GenericReply.cpp b/nxcomp/src/GenericReply.cpp
index 9daccc566..b56e579e8 100644
--- a/nxcomp/GenericReply.cpp
+++ b/nxcomp/src/GenericReply.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "GenericReply.h"
#include "ServerCache.h"
@@ -45,12 +57,9 @@ GenericReplyStore::GenericReplyStore(StaticCompressor *compressor)
enableCache = GENERICREPLY_ENABLE_CACHE;
enableData = GENERICREPLY_ENABLE_DATA;
enableSplit = GENERICREPLY_ENABLE_SPLIT;
- enableCompress = GENERICREPLY_ENABLE_COMPRESS;
- if (control -> isProtoStep7() == 1)
- {
- enableCompress = GENERICREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7;
- }
+ // Since ProtoStep7 (#issue 108)
+ enableCompress = GENERICREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7;
dataLimit = GENERICREPLY_DATA_LIMIT;
dataOffset = GENERICREPLY_DATA_OFFSET;
diff --git a/nxcomp/GenericReply.h b/nxcomp/src/GenericReply.h
index de97b86d0..e899b8467 100644
--- a/nxcomp/GenericReply.h
+++ b/nxcomp/src/GenericReply.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef GenericReply_H
@@ -37,7 +45,6 @@
#define GENERICREPLY_ENABLE_CACHE 1
#define GENERICREPLY_ENABLE_DATA 1
#define GENERICREPLY_ENABLE_SPLIT 0
-#define GENERICREPLY_ENABLE_COMPRESS 1
#define GENERICREPLY_DATA_LIMIT 1048576 - 32
#define GENERICREPLY_DATA_OFFSET 32
diff --git a/nxcomp/GenericRequest.cpp b/nxcomp/src/GenericRequest.cpp
index 40077291b..c569d6a24 100644
--- a/nxcomp/GenericRequest.cpp
+++ b/nxcomp/src/GenericRequest.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "GenericRequest.h"
#include "ClientCache.h"
@@ -45,14 +57,9 @@ GenericRequestStore::GenericRequestStore(StaticCompressor *compressor)
enableCache = GENERICREQUEST_ENABLE_CACHE;
enableData = GENERICREQUEST_ENABLE_DATA;
enableSplit = GENERICREQUEST_ENABLE_SPLIT;
- enableCompress = GENERICREQUEST_ENABLE_COMPRESS;
- if (control -> isProtoStep7() == 1)
- {
- enableCompress = GENERICREQUEST_ENABLE_COMPRESS_IF_PROTO_STEP_7;
-
- enableCompress = 0;
- }
+ // Since ProtoStep7 (#issue 108)
+ enableCompress = GENERICREQUEST_ENABLE_COMPRESS_IF_PROTO_STEP_7;
dataLimit = GENERICREQUEST_DATA_LIMIT;
dataOffset = GENERICREQUEST_DATA_OFFSET;
diff --git a/nxcomp/GenericRequest.h b/nxcomp/src/GenericRequest.h
index 3175fc2ba..13ffea718 100644
--- a/nxcomp/GenericRequest.h
+++ b/nxcomp/src/GenericRequest.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef GenericRequest_H
@@ -37,7 +45,6 @@
#define GENERICREQUEST_ENABLE_CACHE 1
#define GENERICREQUEST_ENABLE_DATA 1
#define GENERICREQUEST_ENABLE_SPLIT 0
-#define GENERICREQUEST_ENABLE_COMPRESS 1
#define GENERICREQUEST_DATA_LIMIT 262144 - 20
#define GENERICREQUEST_DATA_OFFSET 20
diff --git a/nxcomp/GetImage.cpp b/nxcomp/src/GetImage.cpp
index 6be574dbb..20b6a07d1 100644
--- a/nxcomp/GetImage.cpp
+++ b/nxcomp/src/GetImage.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "GetImage.h"
#include "ClientCache.h"
diff --git a/nxcomp/GetImage.h b/nxcomp/src/GetImage.h
index f48fb9079..1c3558d14 100644
--- a/nxcomp/GetImage.h
+++ b/nxcomp/src/GetImage.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef GetImage_H
diff --git a/nxcomp/GetImageReply.cpp b/nxcomp/src/GetImageReply.cpp
index d4bc21b5a..5100804ab 100644
--- a/nxcomp/GetImageReply.cpp
+++ b/nxcomp/src/GetImageReply.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "GetImageReply.h"
#include "ServerCache.h"
@@ -43,12 +55,9 @@ GetImageReplyStore::GetImageReplyStore(StaticCompressor *compressor)
enableCache = GETIMAGEREPLY_ENABLE_CACHE;
enableData = GETIMAGEREPLY_ENABLE_DATA;
enableSplit = GETIMAGEREPLY_ENABLE_SPLIT;
- enableCompress = GETIMAGEREPLY_ENABLE_COMPRESS;
- if (control -> isProtoStep7() == 1)
- {
- enableCompress = GETIMAGEREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7;
- }
+ // Since ProtoStep7 (#issue 108)
+ enableCompress = GETIMAGEREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7;
dataLimit = GETIMAGEREPLY_DATA_LIMIT;
dataOffset = GETIMAGEREPLY_DATA_OFFSET;
diff --git a/nxcomp/GetImageReply.h b/nxcomp/src/GetImageReply.h
index ee7b0bfa3..d4f7c4267 100644
--- a/nxcomp/GetImageReply.h
+++ b/nxcomp/src/GetImageReply.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef GetImageReply_H
@@ -37,7 +45,6 @@
#define GETIMAGEREPLY_ENABLE_CACHE 1
#define GETIMAGEREPLY_ENABLE_DATA 1
#define GETIMAGEREPLY_ENABLE_SPLIT 0
-#define GETIMAGEREPLY_ENABLE_COMPRESS 1
#define GETIMAGEREPLY_DATA_LIMIT 1048576 - 32
#define GETIMAGEREPLY_DATA_OFFSET 32
diff --git a/nxcomp/GetProperty.cpp b/nxcomp/src/GetProperty.cpp
index d358f8a6f..1c5e77ccc 100644
--- a/nxcomp/GetProperty.cpp
+++ b/nxcomp/src/GetProperty.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "GetProperty.h"
#include "ClientCache.h"
diff --git a/nxcomp/GetProperty.h b/nxcomp/src/GetProperty.h
index a73425354..46727280b 100644
--- a/nxcomp/GetProperty.h
+++ b/nxcomp/src/GetProperty.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef GetProperty_H
diff --git a/nxcomp/GetPropertyReply.cpp b/nxcomp/src/GetPropertyReply.cpp
index 223131803..bf6879c5f 100644
--- a/nxcomp/GetPropertyReply.cpp
+++ b/nxcomp/src/GetPropertyReply.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "GetPropertyReply.h"
#include "ServerCache.h"
@@ -45,12 +57,9 @@ GetPropertyReplyStore::GetPropertyReplyStore(StaticCompressor *compressor)
enableCache = GETPROPERTYREPLY_ENABLE_CACHE;
enableData = GETPROPERTYREPLY_ENABLE_DATA;
enableSplit = GETPROPERTYREPLY_ENABLE_SPLIT;
- enableCompress = GETPROPERTYREPLY_ENABLE_COMPRESS;
- if (control -> isProtoStep7() == 1)
- {
- enableCompress = GETPROPERTYREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7;
- }
+ // Since ProtoStep7 (#issue 108)
+ enableCompress = GETPROPERTYREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7;
dataLimit = GETPROPERTYREPLY_DATA_LIMIT;
dataOffset = GETPROPERTYREPLY_DATA_OFFSET;
diff --git a/nxcomp/GetPropertyReply.h b/nxcomp/src/GetPropertyReply.h
index 0f6b19508..01634b408 100644
--- a/nxcomp/GetPropertyReply.h
+++ b/nxcomp/src/GetPropertyReply.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef GetPropertyReply_H
@@ -37,7 +45,6 @@
#define GETPROPERTYREPLY_ENABLE_CACHE 1
#define GETPROPERTYREPLY_ENABLE_DATA 1
#define GETPROPERTYREPLY_ENABLE_SPLIT 0
-#define GETPROPERTYREPLY_ENABLE_COMPRESS 1
#define GETPROPERTYREPLY_DATA_LIMIT 1048576 - 32
#define GETPROPERTYREPLY_DATA_OFFSET 32
diff --git a/nxcomp/ImageText16.cpp b/nxcomp/src/ImageText16.cpp
index 569fdbe13..af057635f 100644
--- a/nxcomp/ImageText16.cpp
+++ b/nxcomp/src/ImageText16.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ImageText16.h"
#include "ClientCache.h"
diff --git a/nxcomp/ImageText16.h b/nxcomp/src/ImageText16.h
index 0e116a4fe..98462ab35 100644
--- a/nxcomp/ImageText16.h
+++ b/nxcomp/src/ImageText16.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ImageText16_H
diff --git a/nxcomp/ImageText8.cpp b/nxcomp/src/ImageText8.cpp
index 161977677..61fcef825 100644
--- a/nxcomp/ImageText8.cpp
+++ b/nxcomp/src/ImageText8.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ImageText8.h"
#include "ClientCache.h"
diff --git a/nxcomp/ImageText8.h b/nxcomp/src/ImageText8.h
index c56502f90..aa9ccb5d9 100644
--- a/nxcomp/ImageText8.h
+++ b/nxcomp/src/ImageText8.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ImageText8_H
diff --git a/nxcomp/IntCache.cpp b/nxcomp/src/IntCache.cpp
index 8262d5605..c72b81200 100644
--- a/nxcomp/IntCache.cpp
+++ b/nxcomp/src/IntCache.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <string.h>
#include "Misc.h"
diff --git a/nxcomp/IntCache.h b/nxcomp/src/IntCache.h
index 15cc8ea53..69c522325 100644
--- a/nxcomp/IntCache.h
+++ b/nxcomp/src/IntCache.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef IntCache_H
diff --git a/nxcomp/InternAtom.cpp b/nxcomp/src/InternAtom.cpp
index d90c8c058..9d0ab1b6d 100644
--- a/nxcomp/InternAtom.cpp
+++ b/nxcomp/src/InternAtom.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "InternAtom.h"
#include "ClientCache.h"
diff --git a/nxcomp/InternAtom.h b/nxcomp/src/InternAtom.h
index f7f366dce..6e69eca24 100644
--- a/nxcomp/InternAtom.h
+++ b/nxcomp/src/InternAtom.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef InternAtom_H
diff --git a/nxcomp/Jpeg.cpp b/nxcomp/src/Jpeg.cpp
index b3973227c..2e8044049 100644
--- a/nxcomp/Jpeg.cpp
+++ b/nxcomp/src/Jpeg.cpp
@@ -1,22 +1,37 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <X11/Xmd.h>
+#ifdef ANDROID
+#include <strings.h>
+#endif
#include <unistd.h>
#include <setjmp.h>
#include <zlib.h>
@@ -91,7 +106,7 @@ static int DecompressJpeg24(unsigned char *compressedData, int compressedLen,
static int DecompressJpeg32(unsigned char *compressedData, int compressedLen,
unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder);
-void UnpackJpegErrorHandler(j_common_ptr cinfo);
+void UnpackJpegErrorHandler(j_common_ptr cinfo) __attribute__((noreturn));
//
// Colormap stuff.
@@ -440,7 +455,7 @@ int DecompressJpeg16(unsigned char *compressedData, int compressedLen,
JpegSetSrcManager(&cinfo, compressedData, compressedLen);
- jpeg_read_header(&cinfo, 1);
+ jpeg_read_header(&cinfo, TRUE);
if (jpegError) goto AbortDecompressJpeg16;
@@ -581,7 +596,7 @@ int DecompressJpeg24(unsigned char *compressedData, int compressedLen,
JpegSetSrcManager(&cinfo, compressedData, compressedLen);
- jpeg_read_header(&cinfo, 1);
+ jpeg_read_header(&cinfo, TRUE);
if (jpegError) goto AbortDecompressJpeg24;
@@ -718,7 +733,7 @@ int DecompressJpeg32(unsigned char *compressedData, int compressedLen,
JpegSetSrcManager(&cinfo, compressedData, compressedLen);
- jpeg_read_header(&cinfo, 1);
+ jpeg_read_header(&cinfo, TRUE);
if (jpegError) goto AbortDecompressJpeg32;
@@ -833,7 +848,7 @@ static boolean JpegFillInputBuffer(j_decompress_ptr cinfo)
jpegSrcManager.bytes_in_buffer = jpegBufferLen;
jpegSrcManager.next_input_byte = (JOCTET *)jpegBufferPtr;
- return 1;
+ return TRUE;
}
static void JpegSkipInputData(j_decompress_ptr cinfo, long num_bytes)
diff --git a/nxcomp/Jpeg.h b/nxcomp/src/Jpeg.h
index f3743d07a..58a5bffef 100644
--- a/nxcomp/Jpeg.h
+++ b/nxcomp/src/Jpeg.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Jpeg_H
diff --git a/nxcomp/Keeper.cpp b/nxcomp/src/Keeper.cpp
index fd9b79f45..4babbe8a6 100644
--- a/nxcomp/Keeper.cpp
+++ b/nxcomp/src/Keeper.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
diff --git a/nxcomp/Keeper.h b/nxcomp/src/Keeper.h
index c357b2116..b440beceb 100644
--- a/nxcomp/Keeper.h
+++ b/nxcomp/src/Keeper.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Keeper_H
diff --git a/nxcomp/List.cpp b/nxcomp/src/List.cpp
index 1ba104b59..b2db7151c 100644
--- a/nxcomp/List.cpp
+++ b/nxcomp/src/List.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "List.h"
//
diff --git a/nxcomp/List.h b/nxcomp/src/List.h
index b5e41ae11..31c80f835 100644
--- a/nxcomp/List.h
+++ b/nxcomp/src/List.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef List_H
diff --git a/nxcomp/ListFontsReply.cpp b/nxcomp/src/ListFontsReply.cpp
index 5bace82f2..16be522a1 100644
--- a/nxcomp/ListFontsReply.cpp
+++ b/nxcomp/src/ListFontsReply.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ListFontsReply.h"
#include "ServerCache.h"
@@ -39,12 +51,9 @@ ListFontsReplyStore::ListFontsReplyStore(StaticCompressor *compressor)
enableCache = LISTFONTSREPLY_ENABLE_CACHE;
enableData = LISTFONTSREPLY_ENABLE_DATA;
enableSplit = LISTFONTSREPLY_ENABLE_SPLIT;
- enableCompress = LISTFONTSREPLY_ENABLE_COMPRESS;
- if (control -> isProtoStep7() == 1)
- {
- enableCompress = LISTFONTSREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7;
- }
+ // Since ProtoStep7 (#issue 108)
+ enableCompress = LISTFONTSREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7;
dataLimit = LISTFONTSREPLY_DATA_LIMIT;
dataOffset = LISTFONTSREPLY_DATA_OFFSET;
diff --git a/nxcomp/ListFontsReply.h b/nxcomp/src/ListFontsReply.h
index 078fd7ebc..c731878e0 100644
--- a/nxcomp/ListFontsReply.h
+++ b/nxcomp/src/ListFontsReply.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ListFontsReply_H
@@ -37,7 +45,6 @@
#define LISTFONTSREPLY_ENABLE_CACHE 1
#define LISTFONTSREPLY_ENABLE_DATA 1
#define LISTFONTSREPLY_ENABLE_SPLIT 0
-#define LISTFONTSREPLY_ENABLE_COMPRESS 1
#define LISTFONTSREPLY_DATA_LIMIT 1048576 - 32
#define LISTFONTSREPLY_DATA_OFFSET 32
diff --git a/nxcomp/src/Log.cpp b/nxcomp/src/Log.cpp
new file mode 100644
index 000000000..24f660507
--- /dev/null
+++ b/nxcomp/src/Log.cpp
@@ -0,0 +1,121 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
+/* */
+/* NXCOMP, NX protocol compression and NX extensions to this software */
+/* are copyright of the aforementioned persons and companies. */
+/* */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
+/* */
+/* All rights reserved. */
+/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
+/**************************************************************************/
+
+
+#include <stdio.h>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <iomanip>
+#include <unistd.h>
+
+#include "Log.h"
+#include "config.h"
+
+NXLog nx_log;
+
+
+bool NXLog::will_log() const
+{
+ std::map<std::string, NXLogLevel>::const_iterator item = per_file_levels_.find(current_file());
+
+ if ( item != per_file_levels_.end() )
+ {
+ return current_level() <= item->second;
+ }
+ else
+ {
+ return current_level() <= level();
+ }
+}
+
+
+std::string NXLog::stamp_to_string(const NXLogStamp& stamp) const
+{
+ std::ostringstream oss;
+
+ static const char* level_names[] = {
+ "FATAL",
+ "ERROR",
+ "WARN ",
+ "INFO ",
+ "DEBUG"
+ };
+
+ if ( log_level() )
+ oss << ((stamp.level() >=0 && stamp.level() < NXLOG_LEVEL_COUNT ) ? level_names[stamp.level()] : "???") << " ";
+
+ if ( log_time() )
+ {
+ struct timeval timestamp = stamp.timestamp();
+ struct tm timeinfo;
+
+ localtime_r(&timestamp.tv_sec, &timeinfo);
+
+ if ( log_unix_time() )
+ {
+ oss << timestamp.tv_sec;
+ }
+ else
+ {
+ #if HAVE_STD_PUT_TIME
+ oss << " " << std::put_time(&timeinfo, "%Y/%m/%d %H:%M:%S");
+ #else
+ oss << timestamp.tv_sec;
+ #endif
+ }
+
+ oss << "." << std::setw(3) << std::setfill('0') << (int)(timestamp.tv_usec / 1000) << " ";
+ }
+
+ if ( log_location() )
+ oss << stamp.file() << "/" << stamp.function() << ":" << stamp.line() << " ";
+
+ if ( log_thread_id() )
+ {
+ if ( thread_name().empty() )
+ oss << getpid() << "/" << pthread_self() << " ";
+ else
+ oss << "[" << thread_name() << "] ";
+ }
+
+ return oss.str();
+}
+
+NXLog& operator<< (NXLog& out, const NXLogStamp& value)
+{
+ out.current_level( value.level() );
+ out.current_file( value.file() );
+
+ // Writing an NXLogStamp to the stream indicates the start of a new entry.
+ // If there's any content in the buffer and we actually intend to keep that line,
+ // create a new entry in the output queue.
+ if ( out.synchronized() && out.will_log() )
+ out.new_stack_entry();
+
+ out << out.stamp_to_string(value);
+
+ return out;
+}
diff --git a/nxcomp/src/Log.h b/nxcomp/src/Log.h
new file mode 100644
index 000000000..3e355a951
--- /dev/null
+++ b/nxcomp/src/Log.h
@@ -0,0 +1,559 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
+/* */
+/* NXCOMP, NX protocol compression and NX extensions to this software */
+/* are copyright of the aforementioned persons and companies. */
+/* */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
+/* */
+/* All rights reserved. */
+/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
+/**************************************************************************/
+
+
+#ifndef NXLog_H
+#define NXLog_H
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <sys/time.h>
+
+#include <map>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <assert.h>
+#include <stack>
+
+/** Log severity level */
+enum NXLogLevel
+{
+ NXFATAL,
+ NXERROR,
+ NXWARNING,
+ NXINFO,
+ NXDEBUG,
+ NXLOG_LEVEL_COUNT
+};
+
+
+/**
+ * Log timestamp class
+ *
+ * Stores the timestamp, file, function, line number and log level.
+ * Acts as a manipulator on the NXLog class, telling it a new log
+ * severity level. For instance:
+ *
+ * nx_log << NXLogStamp(...,NXINFO)
+ *
+ * Tells nx_log that now NXINFO type messages are being logged. This
+ * will be applied until a new NXLogStamp with a different level
+ * is sent to the NXLog.
+ */
+class NXLogStamp
+{
+ private:
+ std::string file_;
+ std::string function_;
+ size_t line_;
+ NXLogLevel level_;
+ struct timeval timestamp_;
+
+ public:
+ /** File where the event occurred */
+ std::string file() const
+ {
+ return file_;
+ }
+
+ /** Function where the event occurred */
+ std::string function() const
+ {
+ return function_;
+ }
+
+ /** Line where the event occurred */
+ size_t line() const
+ {
+ return line_;
+ }
+
+ /** Severity level of the event */
+ NXLogLevel level() const
+ {
+ return level_;
+ }
+
+ /** Time of the event */
+ struct timeval timestamp() const
+ {
+ return timestamp_;
+ }
+
+
+ NXLogStamp(const char *file, const char *function, int line, NXLogLevel level)
+ {
+ file_ = std::string(file);
+ function_ = std::string(function);
+ line_ = line;
+ level_ = level;
+ gettimeofday(&timestamp_, NULL);
+ }
+
+};
+
+
+/**
+ * Log class
+ *
+ * Logs events to a stream, filters by file/level
+ */
+class NXLog
+{
+#ifdef INTERNAL_LOGGING_TEST
+ protected:
+#endif
+ NXLogLevel level_;
+
+ std::ostream *stream_;
+ std::map< std::string, NXLogLevel > per_file_levels_;
+ bool synchronized_;
+ size_t thread_buffer_size_;
+ pthread_mutex_t output_lock_;
+ pthread_key_t tls_key_;
+
+ bool log_level_;
+ bool log_time_;
+ bool log_unix_time_;
+ bool log_location_;
+ bool log_thread_id_;
+
+ typedef struct per_thread_data_s
+ {
+ NXLogLevel current_level;
+ std::string* current_file;
+ std::string* thread_name;
+ std::stack<std::stringstream*> buffer;
+ NXLog* log_obj;
+ } per_thread_data;
+
+
+ static void free_thread_data(void* arg)
+ {
+ per_thread_data *pdt = (per_thread_data*)arg;
+
+ if ( !pdt )
+ return;
+
+ if ( pdt->log_obj ) {
+ // Ensure the buffer is flushed before thread deletion
+ pdt->log_obj->flush(pdt);
+ }
+
+ delete pdt->current_file;
+ delete pdt->thread_name;
+
+ while (!pdt->buffer.empty()) {
+ /*
+ * get the stringstream object created in new_stack_entry()
+ * from the stack and delete it after pop()
+ */
+ std::stringstream* tmp = pdt->buffer.top();
+ (void) pdt->buffer.pop ();
+ delete tmp;
+ }
+
+ delete pdt;
+ }
+
+ per_thread_data* get_data_int() const
+ {
+ per_thread_data *ret = NULL;
+
+ if ( (ret = (per_thread_data*)pthread_getspecific(tls_key_)) == NULL )
+ {
+ ret = new per_thread_data;
+ ret->current_level = NXDEBUG;
+ ret->current_file = new std::string();
+ ret->thread_name = new std::string();
+ ret->log_obj = const_cast<NXLog*>(this);
+ pthread_setspecific(tls_key_, ret);
+ }
+
+ return ret;
+ }
+
+ per_thread_data* get_data()
+ {
+ return get_data_int();
+ }
+
+ const per_thread_data* get_data() const
+ {
+ return get_data_int();
+ }
+
+ /** Convert NXLogStamp to string according to the current configuration */
+ std::string stamp_to_string(const NXLogStamp& stamp) const;
+
+ void new_stack_entry()
+ {
+ per_thread_data *pdt = get_data();
+ pdt->buffer.push(new std::stringstream());
+ }
+
+ /**
+ * Internal flush function
+ *
+ * When a thread is being terminated and free_thread_data gets called,
+ * the TLS key gets set to NULL before the call to free_thread_data,
+ * and the destructor function gets the old value.
+ *
+ * This means that get_data() stops working correctly, and we need
+ * to be able to pass the old pointer.
+ */
+ virtual /* Note: this function needs to be virtual for the logging test application. Don't remove. */
+ void flush(per_thread_data *pdt)
+ {
+ /*
+ * Block all signals until we are dong printing data.
+ * Ensures that a signal handler won't interrupt us
+ * and overwrite the buffer data mid-print, leading
+ * to confusing output.
+ */
+ sigset_t orig_signal_mask,
+ tmp_signal_mask;
+ sigemptyset(&orig_signal_mask);
+
+ /* Set up new mask to block all signals. */
+ sigfillset(&tmp_signal_mask);
+
+ /* Block all signals. */
+ pthread_sigmask(SIG_BLOCK, &tmp_signal_mask, &orig_signal_mask);
+
+ if (!pdt->buffer.empty ()) {
+ /*
+ * get the stringstream object created in new_stack_entry()
+ * from the stack and delete it after pop()
+ */
+ std::stringstream *tmp = pdt->buffer.top();
+ const std::string str = tmp->str();
+
+ if (!str.empty())
+ {
+ pthread_mutex_lock(&output_lock_);
+ (*stream()) << str;
+ pthread_mutex_unlock(&output_lock_);
+ }
+
+ /* Remove from stack. */
+ pdt->buffer.pop();
+
+ /* free memory */
+ delete tmp;
+ }
+
+ /* Restore old signal mask. */
+ pthread_sigmask(SIG_SETMASK, &orig_signal_mask, NULL);
+ }
+
+
+ public:
+ NXLog()
+ {
+ stream_ = &std::cerr;
+ level_ = NXWARNING;
+ synchronized_ = true;
+ thread_buffer_size_ = 1024;
+ log_level_ = false;
+ log_time_ = false;
+ log_unix_time_ = false;
+ log_location_ = false;
+ log_thread_id_ = false;
+
+ if ( pthread_key_create(&tls_key_, free_thread_data) != 0 )
+ {
+ std::cerr << "pthread_key_create failed" << std::endl;
+ abort();
+ }
+
+ }
+
+ ~NXLog()
+ {
+ per_thread_data *pdt = get_data();
+
+ // Flush any remaining output and delete TLS data
+ free_thread_data(pdt);
+
+ pthread_key_delete(tls_key_);
+
+ if ((stream_) && (stream_ != &std::cerr)) {
+ delete stream_;
+ }
+ }
+
+ /** Minimum severity level to output */
+ NXLogLevel level() const
+ {
+ return level_;
+ }
+
+ void level(NXLogLevel level)
+ {
+ level_ = level;
+ }
+
+
+ /** Current severity level */
+ NXLogLevel current_level() const
+ {
+ return get_data()->current_level;
+ }
+
+ void current_level(NXLogLevel level)
+ {
+ get_data()->current_level = level;
+ }
+
+ /** Source file from which messages are currently originating */
+ std::string current_file() const
+ {
+ return *get_data()->current_file;
+ }
+
+ void current_file(std::string val)
+ {
+ *get_data()->current_file = val;
+ }
+
+ std::ostream* stream() const
+ {
+ return stream_;
+ }
+
+ void stream(std::ostream *stream)
+ {
+ flush();
+ stream_ = stream;
+ }
+
+ bool synchronized() const {
+ return synchronized_;
+ }
+
+ void synchronized(bool val) {
+ synchronized_ = val;
+ }
+
+ bool log_level() const
+ {
+ return log_level_;
+ }
+
+ void log_level(bool val)
+ {
+ log_level_ = val;
+ }
+
+ bool log_time() const
+ {
+ return log_time_;
+ }
+
+ void log_time(bool val)
+ {
+ log_time_ = val;
+ }
+
+ bool log_unix_time() const
+ {
+ return log_unix_time_;
+ }
+
+ void log_unix_time(bool val)
+ {
+ log_unix_time_ = val;
+ }
+
+ bool log_location() const
+ {
+ return log_location_;
+ }
+
+ void log_location(bool val)
+ {
+ log_location_ = val;
+ }
+
+ bool log_thread_id() const
+ {
+ return log_thread_id_;
+ }
+
+ void log_thread_id(bool val)
+ {
+ log_thread_id_ = val;
+ }
+
+
+ void flush()
+ {
+ per_thread_data *pdt = get_data();
+ flush(pdt);
+ }
+
+ std::string thread_name() const
+ {
+ return *get_data()->thread_name;
+ }
+
+ void thread_name(std::string str)
+ {
+ *get_data()->thread_name = str;
+ }
+
+ void thread_name(const char *str)
+ {
+ *get_data()->thread_name = str;
+ }
+
+ /**
+ * True if a message sent to the NXLog object will be sent to the output
+ *
+ * This considers two things:
+ *
+ * If there's a per-file log level, then it is used
+ * Otherwise the global log level is used.
+ *
+ * If the log level permits the current message to be output, then the
+ * return value is true.
+ */
+ bool will_log() const;
+
+
+ /**
+ * This catches std::flush
+ */
+ NXLog& operator<<(std::ostream& (*F)(std::ostream&))
+ {
+ if ( will_log() )
+ {
+ if ( synchronized() )
+ {
+ per_thread_data *pdt = get_data();
+ assert (!pdt->buffer.empty ());
+ (*pdt->buffer.top()) << F;
+ flush();
+ }
+ else
+ {
+ *(stream()) << F;
+ }
+ }
+
+ return *this;
+ }
+
+ template<typename T>
+ friend NXLog& operator<<(NXLog& out, const T& value);
+
+ friend NXLog& operator<< (NXLog& out, const NXLogStamp& value);
+};
+
+
+extern NXLog nx_log;
+
+
+#define nxstamp(l) NXLogStamp(__FILE__, __func__, __LINE__, l)
+
+
+#define nxdbg nx_log << nxstamp(NXDEBUG)
+#define nxinfo nx_log << nxstamp(NXINFO)
+#define nxwarn nx_log << nxstamp(NXWARNING)
+#define nxerr nx_log << nxstamp(NXERROR)
+#define nxfatal nx_log << nxstamp(NXFATAL)
+
+
+NXLog& operator<< (NXLog& out, const NXLogStamp& value);
+
+
+template <typename T>
+bool has_newline(T value)
+{
+ return false;
+}
+
+template <char*>
+static bool has_newline(char *value)
+{
+ return strstr(value, "\n") != NULL;
+}
+
+template <char>
+static bool has_newline(char value)
+{
+ return value == '\n';
+}
+
+template <std::string&>
+static bool has_newline(std::string &value)
+{
+ return value.find_first_of("\n") != std::string::npos;
+}
+
+static size_t ss_length(std::stringstream *ss)
+{
+ size_t pos = ss->tellg();
+ size_t ret = 0;
+ ss->seekg(0, std::ios::end);
+ ret = ss->tellg();
+ ss->seekg(pos, std::ios::beg);
+ return ret;
+}
+
+template <typename T>
+NXLog& operator<<(NXLog& out, const T& value)
+{
+ if ( out.will_log() )
+ {
+ if ( out.synchronized() )
+ {
+ // In synchronized mode, we buffer data until a newline, std::flush, or the buffer
+ // gets full. Then we dump the whole thing at once to the output stream, synchronizing
+ // with a mutex.
+ NXLog::per_thread_data *pdt = out.get_data();
+ assert (!pdt->buffer.empty ());
+ (*pdt->buffer.top()) << value;
+
+ if ( ss_length(pdt->buffer.top()) >= out.thread_buffer_size_ || has_newline(value) )
+ out.flush();
+
+ }
+ else
+ {
+ // In async mode we just dump data on the output stream as-is.
+ // Multithreaded code will have ugly output.
+ *(out.stream()) << value;
+ }
+
+ }
+
+ return out;
+}
+
+#endif
diff --git a/nxcomp/Loop.cpp b/nxcomp/src/Loop.cpp
index 92b6fc28f..bb6d18531 100644
--- a/nxcomp/Loop.cpp
+++ b/nxcomp/src/Loop.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -36,7 +48,7 @@
#include <sys/wait.h>
#include <sys/resource.h>
#include <sys/utsname.h>
-
+#include <sys/un.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -67,7 +79,6 @@ typedef int socklen_t;
#ifndef __CYGWIN32__
#include <netinet/tcp.h>
-#include <sys/un.h>
#endif
//
@@ -89,20 +100,13 @@ typedef int socklen_t;
#include "ServerProxy.h"
#include "Message.h"
+#include "ChannelEndPoint.h"
+#include "Log.h"
//
// System specific defines.
//
-#if defined(__EMX__) || defined(__CYGWIN32__)
-
-struct sockaddr_un
-{
- u_short sun_family;
- char sun_path[108];
-};
-
-#endif
//
// HP-UX hides this define.
@@ -238,7 +242,7 @@ struct sockaddr_un
// should connect to remote.
//
-#define WE_INITIATE_CONNECTION (*connectHost != '\0')
+#define WE_INITIATE_CONNECTION (connectSocket.enabled())
//
// Is true if we must provide our credentials
@@ -254,7 +258,7 @@ struct sockaddr_un
//
#define WE_LISTEN_FORWARDER (control -> ProxyMode == proxy_server && \
- listenPort != -1)
+ listenSocket.enabled())
//
// You must define FLUSH in Misc.h if
@@ -328,14 +332,12 @@ Keeper *keeper = NULL;
// to be notified about signals.
//
-int (*handler)(int) = NULL;
+int (*signalHandler)(int) = NULL;
//
-// Signal handling functions.
+// Signal handling functions (that are not already mentioned in Misc.h).
//
-void DisableSignals();
-void EnableSignals();
void InstallSignals();
static void RestoreSignals();
@@ -350,7 +352,7 @@ static void RestoreSignal(int signal);
static int HandleChildren();
-static int HandleChild(int child);
+int HandleChild(int child);
static int CheckChild(int pid, int status);
static int WaitChild(int child, const char *label, int force);
@@ -361,12 +363,9 @@ void RegisterChild(int child);
static int CheckAbort();
//
-// Timer handling utilities.
+// Timer handling utilities (that are not already mentioned in Misc.h).
//
-void SetTimer(int timeout);
-void ResetTimer();
-
static void HandleTimer(int signal);
//
@@ -392,7 +391,7 @@ static int CheckProcess(int pid, const char *label);
// Start or restart the house-keeper process.
//
-static int StartKeeper();
+static void StartKeeper();
//
// Cleanup functions.
@@ -426,26 +425,32 @@ static int SetupProxyInstance();
static int SetupAuthInstance();
static int SetupAgentInstance();
-static int SetupTcpSocket();
-static int SetupUnixSocket();
-static int SetupServiceSockets();
-static int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
- unsigned int &xServerAddrLength);
+static void SetupTcpSocket();
+static void SetupUnixSocket();
+static void SetupServiceSockets();
+static void SetupDisplaySocket(int &addr_family, sockaddr *&addr,
+ unsigned int &addr_length);
//
// Setup a listening socket and accept
// a new connection.
//
-static int ListenConnection(int port, const char *label);
+static int ListenConnection(ChannelEndPoint &endPoint, const char *label);
+static int ListenConnectionTCP(const char *host, long port, const char *label);
+static int ListenConnectionUnix(const char *path, const char *label);
+static int ListenConnectionAny(sockaddr *addr, socklen_t addrlen, const char *label);
static int AcceptConnection(int fd, int domain, const char *label);
//
// Other convenience functions.
//
-static int WaitForRemote(int portNum);
-static int ConnectToRemote(const char *const hostName, int portNum);
+static int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout, int* proxyFileDescriptor, int* reason);
+static int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFileDescriptor, int* reason);
+
+static int WaitForRemote(ChannelEndPoint &socketAddress);
+static int ConnectToRemote(ChannelEndPoint &socketAddress);
static int SendProxyOptions(int fd);
static int SendProxyCaches(int fd);
@@ -475,6 +480,8 @@ static const char *GetArg(int &argi, int argc, const char **argv);
static int CheckArg(const char *type, const char *name, const char *value);
static int ParseArg(const char *type, const char *name, const char *value);
static int ValidateArg(const char *type, const char *name, const char *value);
+static void SetAndValidateChannelEndPointArg(const char *type, const char *name, const char *value,
+ ChannelEndPoint &endPoint);
static int LowercaseArg(const char *type, const char *name, char *value);
static int CheckSignal(int signal);
@@ -508,7 +515,7 @@ static int ParsePackOption(const char *opt);
// given on the command line.
//
-static int ParseHostOption(const char *opt, char *host, int &port);
+static int ParseHostOption(const char *opt, char *host, long &port);
//
// Translate a font server port specification
@@ -518,14 +525,6 @@ static int ParseHostOption(const char *opt, char *host, int &port);
static int ParseFontPath(char *path);
//
-// Determine the interface where to listen for
-// the remote proxy connection or the local
-// forwarder.
-//
-
-static int ParseListenOption(int &interface);
-
-//
// Translate a pack method id in a literal.
//
@@ -661,15 +660,12 @@ static int ReopenLogFile(char *name, ostream *&stream, int limit);
static void handleCheckSessionInLoop();
static void handleCheckBitrateInLoop();
-#if defined(TEST) || defined(INFO)
static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet,
fd_set &writeSet, T_timestamp selectTs);
static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet,
fd_set &writeSet, struct timeval &selectTs,
struct timeval &startTs);
static void handleCheckStateInLoop(int &setFDs);
-#endif
-
static void handleCheckSessionInConnect();
static inline void handleSetReadInLoop(fd_set &readSet, int &setFDs, struct timeval &selectTs);
@@ -713,7 +709,7 @@ static inline void handleTerminatedInLoop();
// Monitor the size of the log file.
//
-static void handleLogReopenInLoop(T_timestamp &logsTs, T_timestamp &nowTs);
+static void handleLogReopenInLoop(T_timestamp &lTs, T_timestamp &nTs);
//
// Directory where the NX binaries and libraries reside.
@@ -946,12 +942,11 @@ static char unixSocketName[DEFAULT_STRING_LENGTH] = { 0 };
// Other parameters.
//
-static char connectHost[DEFAULT_STRING_LENGTH] = { 0 };
static char acceptHost[DEFAULT_STRING_LENGTH] = { 0 };
-static char listenHost[DEFAULT_STRING_LENGTH] = { 0 };
static char displayHost[DEFAULT_STRING_LENGTH] = { 0 };
static char authCookie[DEFAULT_STRING_LENGTH] = { 0 };
+static int loopbackBind = DEFAULT_LOOPBACK_BIND;
static int proxyPort = DEFAULT_NX_PROXY_PORT;
static int xPort = DEFAULT_NX_X_PORT;
@@ -965,24 +960,30 @@ static sockaddr *xServerAddr = NULL;
static unsigned int xServerAddrLength = 0;
//
-// The port where the local proxy will await
-// the peer connection or where the remote
-// proxy will be contacted.
+// The representation of a Unix socket path or
+// a bind address, denoting where the local proxy
+// will await the peer connection.
+//
+
+static ChannelEndPoint listenSocket;
+
+//
+// The TCP host and port or Unix file socket where
+// the remote proxy will be contacted.
//
-static int listenPort = -1;
-static int connectPort = -1;
+static ChannelEndPoint connectSocket;
//
// Helper channels are disabled by default.
//
-static int cupsPort = -1;
-static int auxPort = -1;
-static int smbPort = -1;
-static int mediaPort = -1;
-static int httpPort = -1;
-static int slavePort = -1;
+static ChannelEndPoint cupsPort;
+static ChannelEndPoint auxPort;
+static ChannelEndPoint smbPort;
+static ChannelEndPoint mediaPort;
+static ChannelEndPoint httpPort;
+static ChannelEndPoint slavePort;
//
// Can be either a port number or a Unix
@@ -1020,8 +1021,6 @@ T_timestamp startTs;
T_timestamp logsTs;
T_timestamp nowTs;
-int diffTs;
-
//
// This is set to the main proxy process id.
//
@@ -1148,11 +1147,9 @@ int NXTransProxy(int fd, int mode, const char* options)
if (setjmp(context) == 1)
{
- #ifdef TEST
- *logofs << "NXTransProxy: Out of the long jump with pid '"
- << lastProxy << "'.\n" << logofs_flush;
- #endif
-
+ nxinfo << "NXTransProxy: Out of the long jump with pid '"
+ << lastProxy << "'.\n" << std::flush;
+
return -1;
}
@@ -1170,10 +1167,8 @@ int NXTransProxy(int fd, int mode, const char* options)
lastProxy = getpid();
- #ifdef TEST
- *logofs << "NXTransProxy: Main process started with pid '"
- << lastProxy << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransProxy: Main process started with pid '"
+ << lastProxy << "'.\n" << std::flush;
SetMode(mode);
@@ -1181,15 +1176,13 @@ int NXTransProxy(int fd, int mode, const char* options)
{
if (fd != NX_FD_ANY)
{
- #ifdef TEST
- *logofs << "NXTransProxy: Agent descriptor for X client connections is FD#"
- << fd << ".\n" << logofs_flush;
+ nxinfo << "NXTransProxy: Agent descriptor for X client connections is FD#"
+ << fd << ".\n" << std::flush;
- *logofs << "NXTransProxy: Disabling listening on further X client connections.\n"
- << logofs_flush;
+ nxinfo << "NXTransProxy: Disabling listening on further X client connections.\n"
+ << std::flush;
- #endif
useTcpSocket = 0;
useUnixSocket = 0;
@@ -1202,10 +1195,8 @@ int NXTransProxy(int fd, int mode, const char* options)
{
if (fd != NX_FD_ANY)
{
- #ifdef TEST
- *logofs << "NXTransProxy: PANIC! Agent descriptor for X server connections "
- << "not supported yet.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransProxy: PANIC! Agent descriptor for X server connections "
+ << "not supported yet.\n" << std::flush;
cerr << "Error" << ": Agent descriptor for X server connections "
<< "not supported yet.\n";
@@ -1235,10 +1226,8 @@ int NXTransProxy(int fd, int mode, const char* options)
SetLogs();
- #ifdef TEST
- *logofs << "NXTransProxy: Going to run the NX transport loop.\n"
- << logofs_flush;
- #endif
+ nxinfo << "NXTransProxy: Going to run the NX transport loop.\n"
+ << std::flush;
WaitCleanup();
@@ -1260,20 +1249,16 @@ void NXTransExit(int code)
if (++recurse > 1)
{
- #ifdef TEST
- *logofs << "NXTransExit: Aborting process with pid '"
- << getpid() << "' due to recursion through "
- << "exit.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransExit: Aborting process with pid '"
+ << getpid() << "' due to recursion through "
+ << "exit.\n" << std::flush;
abort();
}
- #ifdef TEST
- *logofs << "NXTransExit: Process with pid '"
- << getpid() << "' called exit with code '"
- << code << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransExit: Process with pid '"
+ << getpid() << "' called exit with code '"
+ << code << "'.\n" << std::flush;
if (control != NULL)
{
@@ -1310,6 +1295,11 @@ void NXTransCleanup()
HandleCleanup();
}
+void NXTransCleanupForReconnect()
+{
+ HandleCleanupForReconnect();
+}
+
//
// Check the parameters for subsequent
// initialization of the NX transport.
@@ -1339,10 +1329,8 @@ int NXTransCreate(int fd, int mode, const char* options)
if (control != NULL)
{
- #ifdef PANIC
- *logofs << "NXTransCreate: PANIC! The NX transport seems "
- << "to be already running.\n" << logofs_flush;
- #endif
+ nxfatal << "NXTransCreate: PANIC! The NX transport seems "
+ << "to be already running.\n" << std::flush;
cerr << "Error" << ": The NX transport seems "
<< "to be already running.\n";
@@ -1354,10 +1342,8 @@ int NXTransCreate(int fd, int mode, const char* options)
if (control == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Error creating the NX transport.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Error creating the NX transport.\n"
+ << std::flush;
cerr << "Error" << ": Error creating the NX transport.\n";
@@ -1366,10 +1352,8 @@ int NXTransCreate(int fd, int mode, const char* options)
lastProxy = getpid();
- #ifdef TEST
- *logofs << "NXTransCreate: Caller process running with pid '"
- << lastProxy << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransCreate: Caller process running with pid '"
+ << lastProxy << "'.\n" << std::flush;
//
// Set the local proxy mode an parse the
@@ -1405,15 +1389,11 @@ int NXTransCreate(int fd, int mode, const char* options)
proxyFD = fd;
- #ifdef TEST
- *logofs << "NXTransCreate: Called with NX proxy descriptor '"
- << proxyFD << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransCreate: Called with NX proxy descriptor '"
+ << proxyFD << "'.\n" << std::flush;
- #ifdef TEST
- *logofs << "NXTransCreate: Creation of the NX transport completed.\n"
- << logofs_flush;
- #endif
+ nxinfo << "NXTransCreate: Creation of the NX transport completed.\n"
+ << std::flush;
return 1;
}
@@ -1451,10 +1431,8 @@ int NXTransAgent(int fd[2])
}
else if (control -> ProxyMode != proxy_client)
{
- #ifdef PANIC
- *logofs << "NXTransAgent: Invalid mode while setting the NX agent.\n"
- << logofs_flush;
- #endif
+ nxfatal << "NXTransAgent: Invalid mode while setting the NX agent.\n"
+ << std::flush;
cerr << "Error" << ": Invalid mode while setting the NX agent.\n\n";
@@ -1468,35 +1446,29 @@ int NXTransAgent(int fd[2])
agentFD[0] = fd[0];
agentFD[1] = fd[1];
- #ifdef TEST
- *logofs << "NXTransAgent: Internal descriptors for agent are FD#"
- << agentFD[0] << " and FD#" << agentFD[1] << ".\n"
- << logofs_flush;
+ nxinfo << "NXTransAgent: Internal descriptors for agent are FD#"
+ << agentFD[0] << " and FD#" << agentFD[1] << ".\n"
+ << std::flush;
- *logofs << "NXTransAgent: Disabling listening for further X client "
- << "connections.\n" << logofs_flush;
+ nxinfo << "NXTransAgent: Disabling listening for further X client "
+ << "connections.\n" << std::flush;
- #endif
agent = new Agent(agentFD);
if (agent == NULL || agent -> isValid() != 1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Error creating the NX memory transport .\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Error creating the NX memory transport .\n"
+ << std::flush;
cerr << "Error" << ": Error creating the NX memory transport.\n";
HandleCleanup();
}
- #ifdef TEST
- *logofs << "NXTransAgent: Enabling memory-to-memory transport.\n"
- << logofs_flush;
- #endif
+ nxinfo << "NXTransAgent: Enabling memory-to-memory transport.\n"
+ << std::flush;
return 1;
}
@@ -1520,21 +1492,17 @@ int NXTransClose(int fd)
{
if (proxy != NULL)
{
- #ifdef TEST
- *logofs << "NXTransClose: Closing down all the X connections.\n"
- << logofs_flush;
- #endif
+ nxinfo << "NXTransClose: Closing down all the X connections.\n"
+ << std::flush;
CleanupConnections();
}
}
- #ifdef TEST
else
{
- *logofs << "NXTransClose: The NX transport is not running.\n"
- << logofs_flush;
+ nxinfo << "NXTransClose: The NX transport is not running.\n"
+ << std::flush;
}
- #endif
return 1;
}
@@ -1562,30 +1530,24 @@ int NXTransDestroy(int fd)
if (proxy != NULL)
{
- #ifdef TEST
- *logofs << "NXTransDestroy: Closing down all the X connections.\n"
- << logofs_flush;
- #endif
+ nxinfo << "NXTransDestroy: Closing down all the X connections.\n"
+ << std::flush;
CleanupConnections();
}
- #ifdef TEST
- *logofs << "NXTransDestroy: Waiting for the NX transport to terminate.\n"
- << logofs_flush;
- #endif
+ nxinfo << "NXTransDestroy: Waiting for the NX transport to terminate.\n"
+ << std::flush;
lastDestroy = 1;
WaitCleanup();
}
- #ifdef TEST
else
{
- *logofs << "NXTransDestroy: The NX transport is not running.\n"
- << logofs_flush;
+ nxinfo << "NXTransDestroy: The NX transport is not running.\n"
+ << std::flush;
}
- #endif
return 1;
}
@@ -1667,10 +1629,8 @@ int NXTransSignal(int signal, int action)
if (action == NX_SIGNAL_RAISE)
{
- #ifdef TEST
- *logofs << "NXTransSignal: Raising signal '" << DumpSignal(signal)
- << "' in the proxy handler.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransSignal: Raising signal '" << DumpSignal(signal)
+ << "' in the proxy handler.\n" << std::flush;
HandleSignal(signal);
@@ -1678,10 +1638,8 @@ int NXTransSignal(int signal, int action)
}
else if (signal == NX_SIGNAL_ANY)
{
- #ifdef TEST
- *logofs << "NXTransSignal: Setting action of all signals to '"
- << action << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransSignal: Setting action of all signals to '"
+ << action << "'.\n" << std::flush;
for (int i = 0; i < 32; i++)
{
@@ -1695,11 +1653,9 @@ int NXTransSignal(int signal, int action)
}
else if (CheckSignal(signal) == 1)
{
- #ifdef TEST
- *logofs << "NXTransSignal: Setting action of signal '"
- << DumpSignal(signal) << "' to '" << action
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransSignal: Setting action of signal '"
+ << DumpSignal(signal) << "' to '" << action
+ << "'.\n" << std::flush;
if (action == NX_SIGNAL_ENABLE ||
action == NX_SIGNAL_FORWARD)
@@ -1716,11 +1672,9 @@ int NXTransSignal(int signal, int action)
}
}
- #ifdef WARNING
- *logofs << "NXTransSignal: WARNING! Unable to perform action '"
- << action << "' on signal '" << DumpSignal(signal)
- << "'.\n" << logofs_flush;
- #endif
+ nxwarn << "NXTransSignal: WARNING! Unable to perform action '"
+ << action << "' on signal '" << DumpSignal(signal)
+ << "'.\n" << std::flush;
cerr << "Warning" << ": Unable to perform action '" << action
<< "' on signal '" << DumpSignal(signal)
@@ -1733,17 +1687,13 @@ int NXTransCongestion(int fd)
{
if (control != NULL && proxy != NULL)
{
- #ifdef DUMP
int congestion = proxy -> getCongestion(proxyFD);
-
- *logofs << "NXTransCongestion: Returning " << congestion
- << " as current congestion level.\n" << logofs_flush;
+ nxdbg << "NXTransCongestion: Returning " << congestion
+ << " as current congestion level.\n" << std::flush;
return congestion;
- #endif
-
return (proxy -> getCongestion(proxyFD));
}
@@ -1781,23 +1731,19 @@ int NXTransHandler(int fd, int type, void (*handler)(void *parameter,
}
default:
{
- #ifdef TEST
- *logofs << "NXTransHandler: WARNING! Failed to set "
- << "the NX callback for event '" << type << "' to '"
- << (void *) handler << "' and parameter '"
- << parameter << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransHandler: WARNING! Failed to set "
+ << "the NX callback for event '" << type << "' to '"
+ << (void *) handler << "' and parameter '"
+ << parameter << "'.\n" << std::flush;
return 0;
}
}
- #ifdef TEST
- *logofs << "NXTransHandler: Set the NX "
- << "callback for event '" << type << "' to '"
- << (void *) handler << "' and parameter '"
- << parameter << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransHandler: Set the NX "
+ << "callback for event '" << type << "' to '"
+ << (void *) handler << "' and parameter '"
+ << parameter << "'.\n" << std::flush;
return 1;
}
@@ -1812,36 +1758,30 @@ int NXTransRead(int fd, char *data, int size)
if (control != NULL && agent != NULL &&
fd == agentFD[0])
{
- #ifdef DUMP
- *logofs << "NXTransRead: Dequeuing " << size << " bytes "
- << "from FD#" << agentFD[0] << ".\n" << logofs_flush;
- #endif
+ nxdbg << "NXTransRead: Dequeuing " << size << " bytes "
+ << "from FD#" << agentFD[0] << ".\n" << std::flush;
int result = agent -> dequeueData(data, size);
- #ifdef DUMP
if (result < 0 && EGET() == EAGAIN)
{
- *logofs << "NXTransRead: WARNING! Dequeuing from FD#"
- << agentFD[0] << " would block.\n" << logofs_flush;
+ nxdbg << "NXTransRead: WARNING! Dequeuing from FD#"
+ << agentFD[0] << " would block.\n" << std::flush;
}
else
{
- *logofs << "NXTransRead: Dequeued " << result << " bytes "
- << "to FD#" << agentFD[0] << ".\n" << logofs_flush;
+ nxdbg << "NXTransRead: Dequeued " << result << " bytes "
+ << "to FD#" << agentFD[0] << ".\n" << std::flush;
}
- #endif
return result;
}
else
{
- #ifdef DUMP
- *logofs << "NXTransRead: Reading " << size << " bytes "
- << "from FD#" << fd << ".\n" << logofs_flush;
- #endif
+ nxdbg << "NXTransRead: Reading " << size << " bytes "
+ << "from FD#" << fd << ".\n" << std::flush;
return read(fd, data, size);
}
@@ -1857,16 +1797,14 @@ int NXTransReadVector(int fd, struct iovec *iovdata, int iovsize)
if (control != NULL && agent != NULL &&
fd == agentFD[0])
{
- #if defined(DUMP)
if (control -> ProxyStage >= stage_operational &&
agent -> localReadable() > 0)
{
- *logofs << "NXTransReadVector: WARNING! Agent has data readable.\n"
- << logofs_flush;
+ nxdbg << "NXTransReadVector: WARNING! Agent has data readable.\n"
+ << std::flush;
}
- #endif
char *base;
@@ -1888,29 +1826,25 @@ int NXTransReadVector(int fd, struct iovec *iovdata, int iovsize)
while (length > 0)
{
- #ifdef DUMP
- *logofs << "NXTransReadVector: Dequeuing " << length
- << " bytes " << "from FD#" << agentFD[0] << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "NXTransReadVector: Dequeuing " << length
+ << " bytes " << "from FD#" << agentFD[0] << ".\n"
+ << std::flush;
result = agent -> dequeueData(base, length);
- #ifdef DUMP
if (result < 0 && EGET() == EAGAIN)
{
- *logofs << "NXTransReadVector: WARNING! Dequeuing from FD#"
- << agentFD[0] << " would block.\n" << logofs_flush;
+ nxdbg << "NXTransReadVector: WARNING! Dequeuing from FD#"
+ << agentFD[0] << " would block.\n" << std::flush;
}
else
{
- *logofs << "NXTransReadVector: Dequeued " << result
- << " bytes " << "from FD#" << agentFD[0] << ".\n"
- << logofs_flush;
+ nxdbg << "NXTransReadVector: Dequeued " << result
+ << " bytes " << "from FD#" << agentFD[0] << ".\n"
+ << std::flush;
}
- #endif
if (result < 0 && total == 0)
{
@@ -1933,11 +1867,9 @@ int NXTransReadVector(int fd, struct iovec *iovdata, int iovsize)
}
else
{
- #ifdef DUMP
- *logofs << "NXTransReadVector: Reading vector with "
- << iovsize << " elements from FD#" << fd << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "NXTransReadVector: Reading vector with "
+ << iovsize << " elements from FD#" << fd << ".\n"
+ << std::flush;
return readv(fd, iovdata, iovsize);
}
@@ -1953,29 +1885,21 @@ int NXTransReadable(int fd, int *readable)
if (control == NULL || agent == NULL ||
fd != agentFD[0])
{
- #ifdef DUMP
int result = GetBytesReadable(fd, readable);
-
if (result == -1)
{
- *logofs << "NXTransReadable: Error detected on FD#"
- << fd << ".\n" << logofs_flush;
+ nxdbg << "NXTransReadable: Error detected on FD#"
+ << fd << ".\n" << std::flush;
}
else
{
- *logofs << "NXTransReadable: Returning " << *readable
- << " bytes as readable from FD#" << fd
- << ".\n" << logofs_flush;
+ nxdbg << "NXTransReadable: Returning " << *readable
+ << " bytes as readable from FD#" << fd
+ << ".\n" << std::flush;
}
return result;
-
- #else
-
- return GetBytesReadable(fd, readable);
-
- #endif
}
int result = agent -> dequeuableData();
@@ -1995,11 +1919,9 @@ int NXTransReadable(int fd, int *readable)
if (proxy != NULL && proxy -> canRead() == 1)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "NXTransReadable: WARNING! Trying to "
- << "read to generate new agent data.\n"
- << logofs_flush;
- #endif
+ nxinfo << "NXTransReadable: WARNING! Trying to "
+ << "read to generate new agent data.\n"
+ << std::flush;
//
// Set the context as the function
@@ -2013,11 +1935,9 @@ int NXTransReadable(int fd, int *readable)
if (proxy -> handleRead() < 0)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "NXTransReadable: Failure reading "
- << "messages from proxy FD#" << proxyFD
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransReadable: Failure reading "
+ << "messages from proxy FD#" << proxyFD
+ << ".\n" << std::flush;
HandleShutdown();
}
@@ -2031,11 +1951,9 @@ int NXTransReadable(int fd, int *readable)
return NXTransReadable(fd, readable);
}
- #ifdef DUMP
- *logofs << "NXTransReadable: Returning " << 0
- << " bytes as readable from FD#" << fd
- << " with result 0.\n" << logofs_flush;
- #endif
+ nxdbg << "NXTransReadable: Returning " << 0
+ << " bytes as readable from FD#" << fd
+ << " with result 0.\n" << std::flush;
*readable = 0;
@@ -2043,11 +1961,9 @@ int NXTransReadable(int fd, int *readable)
}
case -1:
{
- #ifdef DUMP
- *logofs << "NXTransReadable: Returning " << 0
- << " bytes as readable from FD#" << fd
- << " with result -1.\n" << logofs_flush;
- #endif
+ nxdbg << "NXTransReadable: Returning " << 0
+ << " bytes as readable from FD#" << fd
+ << " with result -1.\n" << std::flush;
*readable = 0;
@@ -2055,11 +1971,9 @@ int NXTransReadable(int fd, int *readable)
}
default:
{
- #ifdef DUMP
- *logofs << "NXTransReadable: Returning " << result
- << " bytes as readable from FD#" << fd
- << " with result 0.\n" << logofs_flush;
- #endif
+ nxdbg << "NXTransReadable: Returning " << result
+ << " bytes as readable from FD#" << fd
+ << " with result 0.\n" << std::flush;
*readable = result;
@@ -2088,11 +2002,9 @@ int NXTransWrite(int fd, char *data, int size)
{
if (proxy -> canRead(agentFD[1]) == 0)
{
- #if defined(DUMP) || defined(TEST)
- *logofs << "NXTransWrite: WARNING! Delayed enqueuing to FD#"
- << agentFD[0] << " with proxy unable to read.\n"
- << logofs_flush;
- #endif
+ nxdbg << "NXTransWrite: WARNING! Delayed enqueuing to FD#"
+ << agentFD[0] << " with proxy unable to read.\n"
+ << std::flush;
ESET(EAGAIN);
@@ -2114,11 +2026,9 @@ int NXTransWrite(int fd, char *data, int size)
// but let the channel borrow the buffer.
//
- #ifdef DUMP
- *logofs << "NXTransWrite: Letting the channel borrow "
- << size << " bytes from FD#" << agentFD[0]
- << ".\n" << logofs_flush;
- #endif
+ nxdbg << "NXTransWrite: Letting the channel borrow "
+ << size << " bytes from FD#" << agentFD[0]
+ << ".\n" << std::flush;
result = proxy -> handleRead(agentFD[1], data, size);
@@ -2147,46 +2057,40 @@ int NXTransWrite(int fd, char *data, int size)
// Enqueue the data to the agent transport.
//
- #ifdef DUMP
- *logofs << "NXTransWrite: Enqueuing " << size << " bytes "
- << "to FD#" << agentFD[0] << ".\n" << logofs_flush;
- #endif
+ nxdbg << "NXTransWrite: Enqueuing " << size << " bytes "
+ << "to FD#" << agentFD[0] << ".\n" << std::flush;
result = agent -> enqueueData(data, size);
}
- #ifdef DUMP
if (result < 0)
{
if (EGET() == EAGAIN)
{
- *logofs << "NXTransWrite: WARNING! Enqueuing to FD#"
- << agentFD[0] << " would block.\n"
- << logofs_flush;
+ nxdbg << "NXTransWrite: WARNING! Enqueuing to FD#"
+ << agentFD[0] << " would block.\n"
+ << std::flush;
}
else
{
- *logofs << "NXTransWrite: WARNING! Error enqueuing to FD#"
- << agentFD[0] << ".\n" << logofs_flush;
+ nxdbg << "NXTransWrite: WARNING! Error enqueuing to FD#"
+ << agentFD[0] << ".\n" << std::flush;
}
}
else
{
- *logofs << "NXTransWrite: Enqueued " << result << " bytes "
- << "to FD#" << agentFD[0] << ".\n" << logofs_flush;
+ nxdbg << "NXTransWrite: Enqueued " << result << " bytes "
+ << "to FD#" << agentFD[0] << ".\n" << std::flush;
}
- #endif
return result;
}
else
{
- #ifdef DUMP
- *logofs << "NXTransWrite: Writing " << size << " bytes "
- << "to FD#" << fd << ".\n" << logofs_flush;
- #endif
+ nxdbg << "NXTransWrite: Writing " << size << " bytes "
+ << "to FD#" << fd << ".\n" << std::flush;
return write(fd, data, size);
}
@@ -2218,11 +2122,9 @@ int NXTransWriteVector(int fd, struct iovec *iovdata, int iovsize)
{
if (proxy -> canRead(agentFD[1]) == 0)
{
- #if defined(DUMP) || defined(TEST)
- *logofs << "NXTransWriteVector: WARNING! Delayed enqueuing to FD#"
- << agentFD[0] << " with proxy unable to read.\n"
- << logofs_flush;
- #endif
+ nxdbg << "NXTransWriteVector: WARNING! Delayed enqueuing to FD#"
+ << agentFD[0] << " with proxy unable to read.\n"
+ << std::flush;
ESET(EAGAIN);
@@ -2266,11 +2168,9 @@ int NXTransWriteVector(int fd, struct iovec *iovdata, int iovsize)
// but let the channel borrow the buffer.
//
- #ifdef DUMP
- *logofs << "NXTransWriteVector: Letting the channel borrow "
- << length << " bytes from FD#" << agentFD[0]
- << ".\n" << logofs_flush;
- #endif
+ nxdbg << "NXTransWriteVector: Letting the channel borrow "
+ << length << " bytes from FD#" << agentFD[0]
+ << ".\n" << std::flush;
result = proxy -> handleRead(agentFD[1], base, length);
@@ -2299,39 +2199,35 @@ int NXTransWriteVector(int fd, struct iovec *iovdata, int iovsize)
// Enqueue the data to the agent transport.
//
- #ifdef DUMP
- *logofs << "NXTransWriteVector: Enqueuing " << length
- << " bytes " << "to FD#" << agentFD[0] << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "NXTransWriteVector: Enqueuing " << length
+ << " bytes " << "to FD#" << agentFD[0] << ".\n"
+ << std::flush;
result = agent -> enqueueData(base, length);
}
- #ifdef DUMP
if (result < 0)
{
if (EGET() == EAGAIN)
{
- *logofs << "NXTransWriteVector: WARNING! Enqueuing to FD#"
- << agentFD[0] << " would block.\n"
- << logofs_flush;
+ nxdbg << "NXTransWriteVector: WARNING! Enqueuing to FD#"
+ << agentFD[0] << " would block.\n"
+ << std::flush;
}
else
{
- *logofs << "NXTransWriteVector: WARNING! Error enqueuing to FD#"
- << agentFD[0] << ".\n" << logofs_flush;
+ nxdbg << "NXTransWriteVector: WARNING! Error enqueuing to FD#"
+ << agentFD[0] << ".\n" << std::flush;
}
}
else
{
- *logofs << "NXTransWriteVector: Enqueued " << result
- << " bytes " << "to FD#" << agentFD[0] << ".\n"
- << logofs_flush;
+ nxdbg << "NXTransWriteVector: Enqueued " << result
+ << " bytes " << "to FD#" << agentFD[0] << ".\n"
+ << std::flush;
}
- #endif
if (result < 0 && total == 0)
{
@@ -2354,11 +2250,9 @@ int NXTransWriteVector(int fd, struct iovec *iovdata, int iovsize)
}
else
{
- #ifdef DUMP
- *logofs << "NXTransWriteVector: Writing vector with "
- << iovsize << " elements to FD#" << fd << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "NXTransWriteVector: Writing vector with "
+ << iovsize << " elements to FD#" << fd << ".\n"
+ << std::flush;
return writev(fd, iovdata, iovsize);
}
@@ -2370,13 +2264,11 @@ int NXTransPolicy(int fd, int type)
{
if (usePolicy == -1)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "NXTransPolicy: Setting flush policy on "
- << "proxy FD#" << proxyFD << " to '"
- << DumpPolicy(type == NX_POLICY_DEFERRED ?
- policy_deferred : policy_immediate)
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransPolicy: Setting flush policy on "
+ << "proxy FD#" << proxyFD << " to '"
+ << DumpPolicy(type == NX_POLICY_DEFERRED ?
+ policy_deferred : policy_immediate)
+ << "'.\n" << std::flush;
control -> FlushPolicy = (type == NX_POLICY_DEFERRED ?
policy_deferred : policy_immediate);
@@ -2390,12 +2282,10 @@ int NXTransPolicy(int fd, int type)
}
else
{
- #if defined(TEST) || defined(INFO)
- *logofs << "NXTransPolicy: Ignoring the agent "
- << "setting with user policy set to '"
- << DumpPolicy(control -> FlushPolicy)
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransPolicy: Ignoring the agent "
+ << "setting with user policy set to '"
+ << DumpPolicy(control -> FlushPolicy)
+ << "'.\n" << std::flush;
return 0;
}
@@ -2409,22 +2299,18 @@ int NXTransFlushable(int fd)
if (proxy == NULL || agent == NULL ||
fd != agentFD[0])
{
- #ifdef DUMP
- *logofs << "NXTransFlushable: Returning 0 bytes as "
- << "flushable for unrecognized FD#" << fd
- << ".\n" << logofs_flush;
- #endif
+ nxdbg << "NXTransFlushable: Returning 0 bytes as "
+ << "flushable for unrecognized FD#" << fd
+ << ".\n" << std::flush;
return 0;
}
else
{
- #if defined(DUMP) || defined(INFO)
- *logofs << "NXTransFlushable: Returning " << proxy ->
- getFlushable(proxyFD) << " as bytes flushable on "
- << "proxy FD#" << proxyFD << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "NXTransFlushable: Returning " << proxy ->
+ getFlushable(proxyFD) << " as bytes flushable on "
+ << "proxy FD#" << proxyFD << ".\n"
+ << std::flush;
return proxy -> getFlushable(proxyFD);
}
@@ -2434,11 +2320,9 @@ int NXTransFlush(int fd)
{
if (proxy != NULL)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "NXTransFlush: Requesting an immediate flush of "
- << "proxy FD#" << proxyFD << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "NXTransFlush: Requesting an immediate flush of "
+ << "proxy FD#" << proxyFD << ".\n"
+ << std::flush;
return proxy -> handleFlush();
}
@@ -2460,11 +2344,9 @@ int NXTransChannel(int fd, int channelFd, int type)
return -1;
}
- #if defined(TEST) || defined(INFO)
- *logofs << "NXTransChannel: Going to create a new channel "
- << "with type '" << type << "' on FD#" << channelFd
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "NXTransChannel: Going to create a new channel "
+ << "with type '" << type << "' on FD#" << channelFd
+ << ".\n" << std::flush;
int result = -1;
@@ -2536,25 +2418,21 @@ int NXTransChannel(int fd, int channelFd, int type)
}
default:
{
- #ifdef WARNING
- *logofs << "NXTransChannel: WARNING! Unrecognized channel "
- << "type '" << type << "'.\n" << logofs_flush;
- #endif
+ nxwarn << "NXTransChannel: WARNING! Unrecognized channel "
+ << "type '" << type << "'.\n" << std::flush;
break;
}
}
- #ifdef WARNING
if (result != 1)
{
- *logofs << "NXTransChannel: WARNING! Could not create the "
- << "new channel with type '" << type << "' on FD#"
- << channelFd << ".\n" << logofs_flush;
+ nxwarn << "NXTransChannel: WARNING! Could not create the "
+ << "new channel with type '" << type << "' on FD#"
+ << channelFd << ".\n" << std::flush;
}
- #endif
return result;
}
@@ -2619,11 +2497,9 @@ int NXTransAlert(int code, int local)
{
if (proxy != NULL)
{
- #if defined(DUMP) || defined(INFO)
- *logofs << "NXTransAlert: Requesting a NX dialog with code "
- << code << " and local " << local << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "NXTransAlert: Requesting a NX dialog with code "
+ << code << " and local " << local << ".\n"
+ << std::flush;
if (local == 0)
{
@@ -2650,7 +2526,6 @@ int NXTransAlert(int code, int local)
return 1;
}
- #if defined(DUMP) || defined(INFO)
else
{
if (logofs == NULL)
@@ -2658,10 +2533,9 @@ int NXTransAlert(int code, int local)
logofs = &cerr;
}
- *logofs << "NXTransAlert: Can't request an alert without "
- << "a valid NX transport.\n" << logofs_flush;
+ nxdbg << "NXTransAlert: Can't request an alert without "
+ << "a valid NX transport.\n" << std::flush;
}
- #endif
return 0;
}
@@ -2691,10 +2565,8 @@ int NXTransPrepare(int *setFDs, fd_set *readSet,
return 0;
}
- #if defined(TEST) || defined(INFO)
- *logofs << "\nNXTransPrepare: Going to prepare the NX transport.\n"
- << logofs_flush;
- #endif
+ nxinfo << "NXTransPrepare: Going to prepare the NX transport.\n"
+ << std::flush;
if (control -> ProxyStage < stage_operational)
{
@@ -2702,24 +2574,22 @@ int NXTransPrepare(int *setFDs, fd_set *readSet,
}
else
{
- #if defined(TEST) || defined(INFO)
if (isTimestamp(*selectTs) == 0)
{
- *logofs << "Loop: WARNING! Preparing the select with requested "
- << "timeout of " << selectTs -> tv_sec << " S and "
- << (double) selectTs -> tv_usec / 1000 << " Ms.\n"
- << logofs_flush;
+ nxinfo << "Loop: WARNING! Preparing the select with requested "
+ << "timeout of " << selectTs -> tv_sec << " s and "
+ << (double) selectTs -> tv_usec / 1000 << " ms.\n"
+ << std::flush;
}
else
{
- *logofs << "Loop: Preparing the select with requested "
- << "timeout of " << selectTs -> tv_sec << " S and "
- << (double) selectTs -> tv_usec / 1000 << " Ms.\n"
- << logofs_flush;
+ nxinfo << "Loop: Preparing the select with requested "
+ << "timeout of " << selectTs -> tv_sec << " s and "
+ << (double) selectTs -> tv_usec / 1000 << " ms.\n"
+ << std::flush;
}
- #endif
//
// Set descriptors of listening sockets.
@@ -2759,13 +2629,11 @@ int NXTransPrepare(int *setFDs, fd_set *readSet,
nowTs = getNewTimestamp();
- diffTs = diffTimestamp(startTs, nowTs);
+ int diffTs = diffTimestamp(startTs, nowTs);
- #ifdef TEST
- *logofs << "Loop: Mark - 0 - at " << strMsTimestamp()
- << " with " << diffTs << " Ms elapsed.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Mark - 0 - at " << strMsTimestamp()
+ << " with " << diffTs << " ms elapsed.\n"
+ << std::flush;
//
// TODO: Should add the read time in two
@@ -2781,10 +2649,8 @@ int NXTransPrepare(int *setFDs, fd_set *readSet,
startTs = nowTs;
- #ifdef DEBUG
- *logofs << "Loop: New timestamp is " << strMsTimestamp(startTs)
- << ".\n" << logofs_flush;
- #endif
+ nxdbg << "Loop: New timestamp is " << strMsTimestamp(startTs)
+ << ".\n" << std::flush;
return 1;
}
@@ -2799,12 +2665,10 @@ int NXTransPrepare(int *setFDs, fd_set *readSet,
int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
fd_set *writeSet, struct timeval *selectTs)
{
- #ifdef TIME
+ int diffTs;
static T_timestamp lastTs;
- #endif
-
if (logofs == NULL)
{
logofs = &cerr;
@@ -2826,52 +2690,41 @@ int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
return 0;
}
- #if defined(TEST) || defined(INFO)
- *logofs << "\nNXTransSelect: Going to select the NX descriptors.\n"
- << logofs_flush;
- #endif
+ nxinfo << "NXTransSelect: Going to select the NX descriptors.\n"
+ << std::flush;
- #if defined(TEST) || defined(INFO)
handleCheckSelectInLoop(*setFDs, *readSet, *writeSet, *selectTs);
- #endif
-
- #ifdef TIME
diffTs = diffTimestamp(lastTs, getNewTimestamp());
-
if (diffTs > 20)
{
- *logofs << "Loop: TIME! Spent " << diffTs
- << " Ms handling messages for proxy FD#"
- << proxyFD << ".\n" << logofs_flush;
+ nxdbg << "Loop: TIME! Spent " << diffTs
+ << " ms handling messages for proxy FD#"
+ << proxyFD << ".\n" << std::flush;
}
lastTs = getNewTimestamp();
- #endif
-
- #if defined(TEST) || defined(INFO)
if (isTimestamp(*selectTs) == 0)
{
- *logofs << "Loop: WARNING! Executing the select with requested "
- << "timeout of " << selectTs -> tv_sec << " S and "
- << (double) selectTs -> tv_usec / 1000 << " Ms.\n"
- << logofs_flush;
+ nxinfo << "Loop: WARNING! Executing the select with requested "
+ << "timeout of " << selectTs -> tv_sec << " s and "
+ << (double) selectTs -> tv_usec / 1000 << " ms.\n"
+ << std::flush;
}
else if (proxy != NULL && proxy -> getFlushable(proxyFD) > 0)
{
- *logofs << "Loop: WARNING! Proxy FD#" << proxyFD
- << " has " << proxy -> getFlushable(proxyFD)
- << " bytes to write but timeout is "
- << selectTs -> tv_sec << " S and "
- << selectTs -> tv_usec / 1000 << " Ms.\n"
- << logofs_flush;
+ nxinfo << "Loop: WARNING! Proxy FD#" << proxyFD
+ << " has " << proxy -> getFlushable(proxyFD)
+ << " bytes to write but timeout is "
+ << selectTs -> tv_sec << " s and "
+ << selectTs -> tv_usec / 1000 << " ms.\n"
+ << std::flush;
}
- #endif
//
// Wait for the selected sockets
@@ -2884,31 +2737,24 @@ int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
*errorFDs = EGET();
- #ifdef TIME
diffTs = diffTimestamp(lastTs, getNewTimestamp());
-
if (diffTs > 100)
{
- *logofs << "Loop: TIME! Spent " << diffTs
- << " Ms waiting for new data for proxy FD#"
- << proxyFD << ".\n" << logofs_flush;
+ nxdbg << "Loop: TIME! Spent " << diffTs
+ << " ms waiting for new data for proxy FD#"
+ << proxyFD << ".\n" << std::flush;
}
lastTs = getNewTimestamp();
- #endif
-
//
// Check the result of the select.
//
- #if defined(TEST) || defined(INFO)
handleCheckResultInLoop(*resultFDs, *errorFDs, *setFDs, *readSet, *writeSet, *selectTs, startTs);
- #endif
-
//
// Get time spent in select. The accouting is done
// in milliseconds. This is a real problem on fast
@@ -2921,18 +2767,14 @@ int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
diffTs = diffTimestamp(startTs, nowTs);
- #ifdef TEST
- *logofs << "Loop: Out of select after " << diffTs << " Ms "
- << "at " << strMsTimestamp(nowTs) << " with result "
- << *resultFDs << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Out of select after " << diffTs << " ms "
+ << "at " << strMsTimestamp(nowTs) << " with result "
+ << *resultFDs << ".\n" << std::flush;
startTs = nowTs;
- #ifdef DEBUG
- *logofs << "Loop: New timestamp is " << strMsTimestamp(startTs)
- << ".\n" << logofs_flush;
- #endif
+ nxdbg << "Loop: New timestamp is " << strMsTimestamp(startTs)
+ << ".\n" << std::flush;
if (control -> ProxyStage >= stage_operational)
{
@@ -2960,29 +2802,25 @@ int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
#endif
{
- #ifdef TEST
if (*errorFDs == EINTR)
{
- *logofs << "Loop: Select failed due to EINTR error.\n"
- << logofs_flush;
+ nxinfo << "Loop: Select failed due to EINTR error.\n"
+ << std::flush;
}
else
{
- *logofs << "Loop: WARNING! Call to select failed. Error is "
- << EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
+ nxinfo << "Loop: WARNING! Call to select failed. Error is "
+ << EGET() << " '" << ESTR() << "'.\n"
+ << std::flush;
}
- #endif
}
else
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to select failed. Error is "
+ nxfatal << "Loop: PANIC! Call to select failed. Error is "
<< EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Call to select failed. Error is "
<< EGET() << " '" << ESTR() << "'.\n";
@@ -3019,10 +2857,8 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
return 0;
}
- #if defined(TEST) || defined(INFO)
- *logofs << "\nNXTransExecute: Going to execute I/O on the NX descriptors.\n"
- << logofs_flush;
- #endif
+ nxinfo << "NXTransExecute: Going to execute I/O on the NX descriptors.\n"
+ << std::flush;
if (control -> ProxyStage >= stage_operational)
{
@@ -3036,11 +2872,9 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
handleAgentInLoop(*resultFDs, *errorFDs, *setFDs, *readSet, *writeSet, *selectTs);
}
- #ifdef TEST
- *logofs << "Loop: Mark - 1 - at " << strMsTimestamp()
- << " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Mark - 1 - at " << strMsTimestamp()
+ << " with " << diffTimestamp(startTs, getTimestamp())
+ << " ms elapsed.\n" << std::flush;
//
// Rotate the channel that will be handled
@@ -3055,11 +2889,9 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
handleWritableInLoop(*resultFDs, *writeSet);
- #ifdef TEST
- *logofs << "Loop: Mark - 2 - at " << strMsTimestamp()
- << " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Mark - 2 - at " << strMsTimestamp()
+ << " with " << diffTimestamp(startTs, getTimestamp())
+ << " ms elapsed.\n" << std::flush;
//
// Check if any socket has become readable.
@@ -3067,11 +2899,9 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
handleReadableInLoop(*resultFDs, *readSet);
- #ifdef TEST
- *logofs << "Loop: Mark - 3 - at " << strMsTimestamp()
- << " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Mark - 3 - at " << strMsTimestamp()
+ << " with " << diffTimestamp(startTs, getTimestamp())
+ << " ms elapsed.\n" << std::flush;
//
// Handle the scheduled events on channels.
@@ -3091,11 +2921,9 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
handleEventsInLoop();
- #ifdef TEST
- *logofs << "Loop: Mark - 4 - at " << strMsTimestamp()
- << " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Mark - 4 - at " << strMsTimestamp()
+ << " with " << diffTimestamp(startTs, getTimestamp())
+ << " ms elapsed.\n" << std::flush;
//
// Check if user sent a signal to produce
@@ -3116,11 +2944,9 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
handleAgentLateInLoop(*resultFDs, *errorFDs, *setFDs, *readSet, *writeSet, *selectTs);
}
- #ifdef TEST
- *logofs << "Loop: Mark - 5 - at " << strMsTimestamp()
- << " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Mark - 5 - at " << strMsTimestamp()
+ << " with " << diffTimestamp(startTs, getTimestamp())
+ << " ms elapsed.\n" << std::flush;
//
// Check if there is any data to flush.
@@ -3130,11 +2956,9 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
handleFlushInLoop();
- #ifdef TEST
- *logofs << "Loop: Mark - 6 - at " << strMsTimestamp()
- << " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Mark - 6 - at " << strMsTimestamp()
+ << " with " << diffTimestamp(startTs, getTimestamp())
+ << " ms elapsed.\n" << std::flush;
}
//
@@ -3162,17 +2986,12 @@ int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet,
// Check coherency of internal state.
//
- #if defined(TEST) || defined(INFO)
handleCheckStateInLoop(*setFDs);
- #endif
-
- #ifdef TEST
- *logofs << "Loop: Mark - 7 - at " << strMsTimestamp()
- << " with " << diffTimestamp(startTs, getTimestamp())
- << " Ms elapsed.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Mark - 7 - at " << strMsTimestamp()
+ << " with " << diffTimestamp(startTs, getTimestamp())
+ << " ms elapsed.\n" << std::flush;
}
//
@@ -3213,11 +3032,9 @@ int InitBeforeNegotiation()
startTs = nowTs;
initTs = nowTs;
- #ifdef TEST
- *logofs << "Loop: INIT! Taking mark for initialization at "
- << strMsTimestamp(initTs) << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: INIT! Taking mark for initialization at "
+ << strMsTimestamp(initTs) << ".\n"
+ << std::flush;
//
// If not explicitly specified, determine if local
@@ -3240,30 +3057,24 @@ int InitBeforeNegotiation()
if (control -> ProxyMode == proxy_client)
{
- #ifdef TEST
- *logofs << "Loop: Starting watchdog process with timeout of "
- << control -> InitTimeout / 1000 << " seconds.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Starting watchdog process with timeout of "
+ << control -> InitTimeout / 1000 << " seconds.\n"
+ << std::flush;
lastWatchdog = NXTransWatchdog(control -> InitTimeout);
if (IsFailed(lastWatchdog))
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't start the NX watchdog process.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't start the NX watchdog process.\n"
+ << std::flush;
SetNotRunning(lastWatchdog);
}
- #ifdef TEST
else
{
- *logofs << "Loop: Watchdog started with pid '"
- << lastWatchdog << "'.\n" << logofs_flush;
+ nxinfo << "Loop: Watchdog started with pid '"
+ << lastWatchdog << "'.\n" << std::flush;
}
- #endif
}
//
@@ -3294,11 +3105,9 @@ int InitBeforeNegotiation()
setHostBigEndian(*((unsigned char *) (&test)) == 0);
- #ifdef TEST
- *logofs << "Loop: Local host is "
- << (hostBigEndian() ? "big endian" : "little endian")
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Local host is "
+ << (hostBigEndian() ? "big endian" : "little endian")
+ << ".\n" << std::flush;
if (control -> ProxyMode == proxy_client)
{
@@ -3352,75 +3161,97 @@ int InitBeforeNegotiation()
int SetupProxyConnection()
{
+
if (proxyFD == -1)
{
+
+ char *socketUri = NULL;
+
+ // Let's make sure, the default value for listenSocket is properly set. Doing this
+ // here, because we have to make sure that we call it after the connectSocket
+ // declaration is really really complete.
+
+ if (listenSocket.disabled() && connectSocket.disabled())
+ {
+ char listenPortValue[20] = { 0 };
+ sprintf(listenPortValue, "%ld", (long)(proxyPort + DEFAULT_NX_PROXY_PORT_OFFSET));
+
+ SetAndValidateChannelEndPointArg("local", "listen", listenPortValue, listenSocket);
+ }
+
+ connectSocket.getSpec(&socketUri);
+ nxinfo << "Loop: connectSocket is "<< ( connectSocket.enabled() ? "enabled" : "disabled") << ". "
+ << "The socket URI is '"<< ( socketUri != NULL ? socketUri : "<unset>") << "'.\n" << std::flush;
+
+ listenSocket.getSpec(&socketUri);
+ nxinfo << "Loop: listenSocket is "<< ( listenSocket.enabled() ? "enabled" : "disabled") << ". "
+ << "The socket URI is '"<< ( socketUri != NULL ? socketUri : "<unset>") << "'.\n" << std::flush;
+
+ SAFE_FREE(socketUri);
+
if (WE_INITIATE_CONNECTION)
{
- if (connectPort < 0)
+ if (connectSocket.getSpec(&socketUri))
{
- connectPort = DEFAULT_NX_PROXY_PORT_OFFSET + proxyPort;
- }
+ nxinfo << "Loop: Going to connect to '" << socketUri
+ << "'.\n" << std::flush;
+ SAFE_FREE(socketUri);
- #ifdef TEST
- *logofs << "Loop: Going to connect to " << connectHost
- << ":" << connectPort << ".\n" << logofs_flush;
- #endif
-
- proxyFD = ConnectToRemote(connectHost, connectPort);
+ proxyFD = ConnectToRemote(connectSocket);
- #ifdef TEST
- *logofs << "Loop: Connected to remote proxy on FD#"
- << proxyFD << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Connected to remote proxy on FD#"
+ << proxyFD << ".\n" << std::flush;
- cerr << "Info" << ": Connection to remote proxy '" << connectHost
- << ":" << connectPort << "' established.\n";
+ cerr << "Info" << ": Connected to remote proxy on FD#"
+ << proxyFD << ".\n";
+ }
}
else
{
- if (listenPort < 0)
+
+ if (listenSocket.isTCPSocket() && (listenSocket.getTCPPort() < 0))
{
- listenPort = DEFAULT_NX_PROXY_PORT_OFFSET + proxyPort;
+ listenSocket.setSpec(DEFAULT_NX_PROXY_PORT_OFFSET + proxyPort);
}
- #ifdef TEST
- *logofs << "Loop: Going to wait for connection on port "
- << listenPort << ".\n" << logofs_flush;
- #endif
+ if (listenSocket.getSpec(&socketUri))
+ {
+ nxinfo << "Loop: Going to wait for connection at '"
+ << socketUri << "'.\n" << std::flush;
+ SAFE_FREE(socketUri);
- proxyFD = WaitForRemote(listenPort);
+ proxyFD = WaitForRemote(listenSocket);
- #ifdef TEST
+ if (WE_LISTEN_FORWARDER)
+ {
+ nxinfo << "Loop: Connected to remote forwarder on FD#"
+ << proxyFD << ".\n" << std::flush;
+ }
+ else
+ {
+ nxinfo << "Loop: Connected to remote proxy on FD#"
+ << proxyFD << ".\n" << std::flush;
+ }
- if (WE_LISTEN_FORWARDER)
- {
- *logofs << "Loop: Connected to remote forwarder on FD#"
- << proxyFD << ".\n" << logofs_flush;
- }
- else
- {
- *logofs << "Loop: Connected to remote proxy on FD#"
- << proxyFD << ".\n" << logofs_flush;
}
-
- #endif
}
}
- #ifdef TEST
else
{
- *logofs << "Loop: Using the inherited connection on FD#"
- << proxyFD << ".\n" << logofs_flush;
+ nxinfo << "Loop: Using the inherited connection on FD#"
+ << proxyFD << ".\n" << std::flush;
}
- #endif
//
// Set TCP_NODELAY on proxy descriptor
// to reduce startup time. Option will
// later be disabled if needed.
//
+ // either listenSocket or connectSocket is used here...
+
+ if(listenSocket.isTCPSocket() || connectSocket.isTCPSocket())
- SetNoDelay(proxyFD, 1);
+ SetNoDelay(proxyFD, 1);
//
// We need non-blocking input since the
@@ -3439,10 +3270,8 @@ int SetupProxyConnection()
int InitAfterNegotiation()
{
- #ifdef TEST
- *logofs << "Loop: Connection with remote proxy completed.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Connection with remote proxy completed.\n"
+ << std::flush;
cerr << "Info" << ": Connection with remote proxy completed.\n"
<< logofs_flush;
@@ -3528,12 +3357,10 @@ int InitAfterNegotiation()
// rated by the proxy.
//
- #ifdef TEST
- *logofs << "Loop: INIT! Completed initialization at "
- << strMsTimestamp(nowTs) << " with "
- << diffTimestamp(initTs, nowTs) << " Ms "
- << "since the init mark.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: INIT! Completed initialization at "
+ << strMsTimestamp(nowTs) << " with "
+ << diffTimestamp(initTs, nowTs) << " ms "
+ << "since the init mark.\n" << std::flush;
initTs = getNewTimestamp();
@@ -3561,21 +3388,17 @@ int SetMode(int mode)
{
if (mode == NX_MODE_CLIENT)
{
- #ifdef TEST
- *logofs << "Loop: INIT! Initializing with mode "
- << "NX_MODE_CLIENT at " << strMsTimestamp()
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: INIT! Initializing with mode "
+ << "NX_MODE_CLIENT at " << strMsTimestamp()
+ << ".\n" << std::flush;
control -> ProxyMode = proxy_client;
}
else if (mode == NX_MODE_SERVER)
{
- #ifdef TEST
- *logofs << "Loop: INIT! Initializing with mode "
- << "NX_MODE_SERVER at " << strMsTimestamp()
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: INIT! Initializing with mode "
+ << "NX_MODE_SERVER at " << strMsTimestamp()
+ << ".\n" << std::flush;
control -> ProxyMode = proxy_server;
}
@@ -3604,10 +3427,8 @@ int SetupProxyInstance()
if (proxy == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Error creating the NX proxy.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Error creating the NX proxy.\n"
+ << std::flush;
cerr << "Error" << ": Error creating the NX proxy.\n";
@@ -3622,10 +3443,8 @@ int SetupProxyInstance()
if (statistics == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Error creating the NX statistics.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Error creating the NX statistics.\n"
+ << std::flush;
cerr << "Error" << ": Error creating the NX statistics.\n";
@@ -3677,10 +3496,8 @@ int SetupProxyInstance()
proxy -> handleLinkConfiguration() < 0 ||
proxy -> handleCacheConfiguration() < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Error configuring the NX transport.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Error configuring the NX transport.\n"
+ << std::flush;
cerr << "Error" << ": Error configuring the NX transport.\n";
@@ -3727,16 +3544,14 @@ int SetupProxyInstance()
proxy -> handleFlush();
- #if defined(TEST) || defined(INFO)
if (proxy -> getFlushable(proxyFD) > 0)
{
- *logofs << "Loop: WARNING! Proxy FD#" << proxyFD << " has data "
- << "to flush after setup of the NX transport.\n"
- << logofs_flush;
+ nxinfo << "Loop: WARNING! Proxy FD#" << proxyFD << " has data "
+ << "to flush after setup of the NX transport.\n"
+ << std::flush;
}
- #endif
return 1;
}
@@ -3770,7 +3585,15 @@ int SetupAuthInstance()
launchdAddrUnix.sun_family = AF_UNIX;
+ #ifdef __linux__
const int launchdAddrNameLength = 108;
+ #else
+ /* POSIX/SUS does not specify a length.
+ * BSD derivatives generally support 104 bytes, other systems may be more constrained.
+ * If you happen to run into such systems, extend this section with the appropriate limit.
+ */
+ const int launchdAddrNameLength = 104;
+ #endif
int success = -1;
@@ -3778,29 +3601,23 @@ int SetupAuthInstance()
*(launchdAddrUnix.sun_path + launchdAddrNameLength - 1) = '\0';
- #ifdef TEST
- *logofs << "Loop: Connecting to launchd service "
- << "on Unix port '" << displayHost << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Connecting to launchd service "
+ << "on Unix port '" << displayHost << "'.\n" << std::flush;
int launchdFd = socket(launchdAddrFamily, SOCK_STREAM, PF_UNSPEC);
if (launchdFd < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to socket failed. "
+ nxfatal << "Loop: PANIC! Call to socket failed. "
<< "Error is " << EGET() << " '" << ESTR()
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
}
else if ((success = connect(launchdFd, (sockaddr *) &launchdAddrUnix, launchdAddrLength)) < 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Connection to launchd service "
- << "on Unix port '" << displayHost << "' failed "
- << "with error " << EGET() << ", '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Connection to launchd service "
+ << "on Unix port '" << displayHost << "' failed "
+ << "with error " << EGET() << ", '" << ESTR() << "'.\n"
+ << std::flush;
}
if (launchdFd >= 0)
@@ -3840,10 +3657,8 @@ int SetupAuthInstance()
if (auth == NULL || auth -> isValid() != 1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Error creating the X authorization.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Error creating the X authorization.\n"
+ << std::flush;
cerr << "Error" << ": Error creating the X authorization.\n";
@@ -3851,11 +3666,9 @@ int SetupAuthInstance()
}
else if (auth -> isFake() == 1)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Could not retrieve the X server "
- << "authentication cookie.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Could not retrieve the X server "
+ << "authentication cookie.\n"
+ << std::flush;
cerr << "Warning" << ": Failed to read data from the X "
<< "auth command.\n";
@@ -3866,18 +3679,14 @@ int SetupAuthInstance()
}
else
{
- #ifdef TEST
- *logofs << "Loop: No proxy cookie was provided for "
- << "authentication.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: No proxy cookie was provided for "
+ << "authentication.\n" << std::flush;
cerr << "Info" << ": No proxy cookie was provided for "
<< "authentication.\n";
- #ifdef TEST
- *logofs << "Loop: Forwarding the real X authorization "
- << "cookie.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Forwarding the real X authorization "
+ << "cookie.\n" << std::flush;
cerr << "Info" << ": Forwarding the real X authorization "
<< "cookie.\n";
@@ -3913,10 +3722,8 @@ int SetupAgentInstance()
if (result < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Error creating the NX agent connection.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Error creating the NX agent connection.\n"
+ << std::flush;
cerr << "Error" << ": Error creating the NX agent connection.\n";
@@ -3927,163 +3734,44 @@ int SetupAgentInstance()
return 1;
}
-int SetupTcpSocket()
+void SetupTcpSocket()
{
//
// Open TCP socket emulating local display.
//
- tcpFD = socket(AF_INET, SOCK_STREAM, PF_UNSPEC);
-
- if (tcpFD == -1)
- {
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to socket failed for TCP socket"
- << ". Error is " << EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
-
- cerr << "Error" << ": Call to socket failed for TCP socket"
- << ". Error is " << EGET() << " '" << ESTR() << "'.\n";
-
- HandleCleanup();
- }
- else if (SetReuseAddress(tcpFD) < 0)
- {
- HandleCleanup();
- }
-
- unsigned int proxyPortTCP = X_TCP_PORT + proxyPort;
-
- sockaddr_in tcpAddr;
-
- tcpAddr.sin_family = AF_INET;
- tcpAddr.sin_port = htons(proxyPortTCP);
- tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY);
-
- if (bind(tcpFD, (sockaddr *) &tcpAddr, sizeof(tcpAddr)) == -1)
- {
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to bind failed for TCP port "
- << proxyPortTCP << ". Error is " << EGET() << " '" << ESTR()
- << "'.\n" << logofs_flush;
- #endif
-
- cerr << "Error" << ": Call to bind failed for TCP port "
- << proxyPortTCP << ". Error is " << EGET() << " '" << ESTR()
- << "'.\n";
-
- HandleCleanup();
- }
-
- if (listen(tcpFD, 8) == -1)
- {
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to listen failed for TCP port "
- << proxyPortTCP << ". Error is " << EGET() << " '" << ESTR()
- << "'.\n" << logofs_flush;
- #endif
-
- cerr << "Error" << ": Call to listen failed for TCP port "
- << proxyPortTCP << ". Error is " << EGET() << " '" << ESTR()
- << "'.\n";
-
- HandleCleanup();
- }
-
- return 1;
+ tcpFD = ListenConnectionTCP((loopbackBind ? "localhost" : "*"), X_TCP_PORT + proxyPort, "X11");
}
-int SetupUnixSocket()
+void SetupUnixSocket()
{
//
// Open UNIX domain socket for display.
//
- unixFD = socket(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
-
- if (unixFD == -1)
- {
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to socket failed for UNIX domain"
- << ". Error is " << EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
-
- cerr << "Error" << ": Call to socket failed for UNIX domain"
- << ". Error is " << EGET() << " '" << ESTR() << "'.\n";
-
- HandleCleanup();
- }
-
- sockaddr_un unixAddr;
- unixAddr.sun_family = AF_UNIX;
-
- char dirName[DEFAULT_STRING_LENGTH];
-
- snprintf(dirName, DEFAULT_STRING_LENGTH - 1, "%s/.X11-unix",
- control -> TempPath);
-
- *(dirName + DEFAULT_STRING_LENGTH - 1) = '\0';
-
- struct stat dirStat;
-
- if ((stat(dirName, &dirStat) == -1) && (EGET() == ENOENT))
- {
- mkdir(dirName, (0777 | S_ISVTX));
- chmod(dirName, (0777 | S_ISVTX));
- }
-
- snprintf(unixSocketName, DEFAULT_STRING_LENGTH - 1, "%s/X%d",
- dirName, proxyPort);
-
- strncpy(unixAddr.sun_path, unixSocketName, 108);
+ unsigned int required = snprintf(unixSocketName, DEFAULT_STRING_LENGTH, "/tmp/.X11-unix");
+ if (required < sizeof(unixSocketName)) {
- #ifdef TEST
- *logofs << "Loop: Assuming Unix socket with name '"
- << unixAddr.sun_path << "'.\n"
- << logofs_flush;
- #endif
+ // No need to execute the following actions conditionally
+ mkdir(unixSocketName, (0777 | S_ISVTX));
+ chmod(unixSocketName, (0777 | S_ISVTX));
- *(unixAddr.sun_path + 107) = '\0';
-
- if (bind(unixFD, (sockaddr *) &unixAddr, sizeof(unixAddr)) == -1)
- {
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to bind failed for UNIX domain socket "
- << unixSocketName << ". Error is " << EGET() << " '" << ESTR()
- << "'.\n" << logofs_flush;
- #endif
-
- cerr << "Error" << ": Call to bind failed for UNIX domain socket "
- << unixSocketName << ". Error is " << EGET() << " '" << ESTR()
- << "'.\n";
-
- HandleCleanup();
- }
-
- if (listen(unixFD, 8) == -1)
- {
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to listen failed for UNIX domain socket "
- << unixSocketName << ". Error is " << EGET() << " '" << ESTR()
- << "'.\n" << logofs_flush;
- #endif
+ required = snprintf(unixSocketName, DEFAULT_STRING_LENGTH, "/tmp/.X11-unix/X%d", proxyPort);
+ if (required < sizeof(unixSocketName)) {
- cerr << "Error" << ": Call to listen failed for UNIX domain socket "
- << unixSocketName << ". Error is " << EGET() << " '" << ESTR()
- << "'.\n";
-
- HandleCleanup();
+ unixFD = ListenConnectionUnix(unixSocketName, "x11");
+ if (unixFD >= 0)
+ chmod(unixSocketName, 0777);
+ return;
+ }
}
- //
- // Let any local user to gain access to socket.
- //
+ unixSocketName[0] = '\0'; // Just in case!
- chmod(unixSocketName, 0777);
+ nxfatal << "Loop: PANIC! path for unix socket is too long.\n" << std::flush;
- return 1;
+ cerr << "Error" << ": path for Unix socket is too long.\n";
+ HandleCleanup();
}
//
@@ -4092,12 +3780,12 @@ int SetupUnixSocket()
// implementation.
//
-int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
- unsigned int &xServerAddrLength)
+void SetupDisplaySocket(int &addr_family, sockaddr *&addr,
+ unsigned int &addr_length)
{
- xServerAddrFamily = AF_INET;
- xServerAddr = NULL;
- xServerAddrLength = 0;
+ addr_family = AF_INET;
+ addr = NULL;
+ addr_length = 0;
char *display;
@@ -4114,10 +3802,8 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
if (display == NULL || *display == '\0')
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Host X server DISPLAY is not set.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Host X server DISPLAY is not set.\n"
+ << std::flush;
cerr << "Error" << ": Host X server DISPLAY is not set.\n";
@@ -4125,12 +3811,11 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
}
else if (strncasecmp(display, "nx/nx,", 6) == 0 ||
strncasecmp(display, "nx,", 3) == 0 ||
- strncasecmp(display, "nx:", 3) == 0)
+ strncasecmp(display, "nx/nx:", 6) == 0 ||
+ strncasecmp(display, "nx:", 3) == 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! NX transport on host X server '"
- << display << "' not supported.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! NX transport on host X server '"
+ << display << "' not supported.\n" << std::flush;
cerr << "Error" << ": NX transport on host X server '"
<< display << "' not supported.\n";
@@ -4142,11 +3827,9 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
}
else if (strlen(display) >= DEFAULT_STRING_LENGTH)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Host X server DISPLAY cannot exceed "
+ nxfatal << "Loop: PANIC! Host X server DISPLAY cannot exceed "
<< DEFAULT_STRING_LENGTH << " characters.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Host X server DISPLAY cannot exceed "
<< DEFAULT_STRING_LENGTH << " characters.\n";
@@ -4161,10 +3844,8 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
if (display == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Out of memory handling DISPLAY variable.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Out of memory handling DISPLAY variable.\n"
+ << std::flush;
cerr << "Error" << ": Out of memory handling DISPLAY variable.\n";
@@ -4175,26 +3856,22 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
#ifdef __APPLE__
- if (strncasecmp(display, "/tmp/launch", 11) == 0)
+ if ((strncasecmp(display, "/tmp/launch", 11) == 0) || (strncasecmp(display, "/private/tmp/com.apple.launchd", 30) == 0))
{
- #ifdef TEST
- *logofs << "Loop: Using launchd service on socket '"
- << display << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Using launchd service on socket '"
+ << display << "'.\n" << std::flush;
useLaunchdSocket = 1;
}
#endif
- char *separator = rindex(display, ':');
+ char *separator = strrchr(display, ':');
if ((separator == NULL) || !isdigit(*(separator + 1)))
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid display '" << display << "'.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Invalid display '" << display << "'.\n"
+ << std::flush;
cerr << "Error" << ": Invalid display '" << display << "'.\n";
@@ -4205,11 +3882,9 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
xPort = atoi(separator + 1);
- #ifdef TEST
- *logofs << "Loop: Using local X display '" << displayHost
- << "' with host '" << display << "' and port '"
- << xPort << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Using local X display '" << displayHost
+ << "' with host '" << display << "' and port '"
+ << xPort << "'.\n" << std::flush;
#ifdef __APPLE__
@@ -4226,14 +3901,12 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
// UNIX domain port.
//
- #ifdef TEST
- *logofs << "Loop: Using real X server on UNIX domain socket.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Using real X server on UNIX domain socket.\n"
+ << std::flush;
sockaddr_un *xServerAddrUNIX = new sockaddr_un;
- xServerAddrFamily = AF_UNIX;
+ addr_family = AF_UNIX;
xServerAddrUNIX -> sun_family = AF_UNIX;
//
@@ -4250,12 +3923,44 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
// where the socket will be created.
//
+ // Try abstract X11 socket first (via a test connect), if that fails
+ // fall back to Unix domain socket file.
+
+ #ifdef __linux__
+ int testSocketFD;
+ testSocketFD = socket(addr_family, SOCK_STREAM, PF_UNSPEC);
+
+ int len = sprintf(unixSocketName + 1, "/tmp/.X11-unix/X%d", xPort);
+ unixSocketName[0] = '\0';
+
+ sockaddr_un *xServerAddrABSTRACT = new sockaddr_un;
+ memset(xServerAddrABSTRACT, 0, addr_length);
+ xServerAddrABSTRACT -> sun_family = AF_UNIX;
+ memcpy(xServerAddrABSTRACT -> sun_path, unixSocketName, len+1);
+ addr_length = len +3;
+
+ int ret = connect(testSocketFD, (struct sockaddr *) xServerAddrABSTRACT, addr_length);
+ if (ret == 0) {
+
+ cerr << "Info" << ": Using abstract X11 socket in kernel namespace "
+ << "for accessing DISPLAY=:" << xPort << ".\n";
+
+ close(testSocketFD);
+ addr = (sockaddr *) xServerAddrABSTRACT;
+ return;
+
+ } else {
+
+ cerr << "Info" << ": Falling back to file system X11 socket "
+ << "for accessing DISPLAY=:" << xPort << ".\n";
+
+ #endif
+
struct stat statInfo;
char unixSocketDir[DEFAULT_STRING_LENGTH];
- snprintf(unixSocketDir, DEFAULT_STRING_LENGTH - 1, "%s/.X11-unix",
- control -> TempPath);
+ snprintf(unixSocketDir, DEFAULT_STRING_LENGTH - 1, "/tmp/.X11-unix");
#ifdef __APPLE__
@@ -4275,26 +3980,20 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
*(unixSocketDir + DEFAULT_STRING_LENGTH - 1) = '\0';
- #ifdef TEST
- *logofs << "Loop: Assuming X socket in directory '"
- << unixSocketDir << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming X socket in directory '"
+ << unixSocketDir << "'.\n" << std::flush;
if (stat(unixSocketDir, &statInfo) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't determine the location of "
- << "the X display socket.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't determine the location of "
+ << "the X display socket.\n" << std::flush;
cerr << "Error" << ": Can't determine the location of "
<< "the X display socket.\n";
- #ifdef PANIC
- *logofs << "Loop: PANIC! Error " << EGET() << " '" << ESTR()
+ nxfatal << "Loop: PANIC! Error " << EGET() << " '" << ESTR()
<< "' checking '" << unixSocketDir << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Error " << EGET() << " '" << ESTR()
<< "' checking '" << unixSocketDir << "'.\n";
@@ -4313,15 +4012,18 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
#endif
- #ifdef TEST
- *logofs << "Loop: Assuming X socket name '" << unixSocketName
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming X socket name '" << unixSocketName
+ << "'.\n" << std::flush;
strcpy(xServerAddrUNIX -> sun_path, unixSocketName);
- xServerAddr = (sockaddr *) xServerAddrUNIX;
- xServerAddrLength = sizeof(sockaddr_un);
+ addr = (sockaddr *) xServerAddrUNIX;
+ addr_length = sizeof(sockaddr_un);
+
+ #ifdef __linux__
+
+ }
+ #endif
}
else
{
@@ -4329,21 +4031,17 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
// TCP port.
//
- #ifdef TEST
- *logofs << "Loop: Using real X server on TCP port.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Using real X server on TCP port.\n"
+ << std::flush;
- xServerAddrFamily = AF_INET;
+ addr_family = AF_INET;
int xServerIPAddr = GetHostAddress(display);
if (xServerIPAddr == 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Unknown display host '" << display
- << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Unknown display host '" << display
+ << "'.\n" << std::flush;
cerr << "Error" << ": Unknown display host '" << display
<< "'.\n";
@@ -4357,16 +4055,14 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
xServerAddrTCP -> sin_port = htons(X_TCP_PORT + xPort);
xServerAddrTCP -> sin_addr.s_addr = xServerIPAddr;
- xServerAddr = (sockaddr *) xServerAddrTCP;
- xServerAddrLength = sizeof(sockaddr_in);
+ addr = (sockaddr *) xServerAddrTCP;
+ addr_length = sizeof(sockaddr_in);
}
delete [] display;
-
- return 1;
}
-int SetupServiceSockets()
+void SetupServiceSockets()
{
if (control -> ProxyMode == proxy_client)
{
@@ -4415,32 +4111,16 @@ int SetupServiceSockets()
else
{
//
- // Disable the font server connections if
- // they are not supported by the remote
- // proxy.
+ // Get ready to listen for the font server connections
//
if (useFontSocket)
{
- if (control -> isProtoStep7() == 1)
- {
- int port = atoi(fontPort);
+ // Since ProtoStep7 (#issue 108)
+ int port = atoi(fontPort);
- if ((fontFD = ListenConnection(port, "font")) < 0)
- {
- useFontSocket = 0;
- }
- }
- else
+ if ((fontFD = ListenConnectionTCP("localhost", port, "font")) < 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Font server connections not supported "
- << "by the remote proxy.\n" << logofs_flush;
- #endif
-
- cerr << "Warning" << ": Font server connections not supported "
- << "by the remote proxy.\n";
-
useFontSocket = 0;
}
}
@@ -4459,86 +4139,58 @@ int SetupServiceSockets()
if (useSlaveSocket)
{
- if (control -> isProtoStep7() == 1)
+ // Since ProtoStep7 (#issue 108)
+ if ((slaveFD = ListenConnection(slavePort, "slave")) < 0)
{
- if ((slaveFD = ListenConnection(slavePort, "slave")) < 0)
- {
- useSlaveSocket = 0;
- }
- }
- else
- {
- #ifdef WARNING
- *logofs << "Loop: WARNING! Slave connections not supported "
- << "by the remote proxy.\n" << logofs_flush;
- #endif
-
- cerr << "Warning" << ": Slave connections not supported "
- << "by the remote proxy.\n";
-
useSlaveSocket = 0;
}
}
-
- return 1;
}
-int ListenConnection(int port, const char *label)
+int ListenConnectionAny(sockaddr *addr, socklen_t addrlen, const char *label)
{
- sockaddr_in tcpAddr;
-
- unsigned int portTCP = port;
-
- int newFD = socket(AF_INET, SOCK_STREAM, PF_UNSPEC);
+ int newFD = socket(addr->sa_family, SOCK_STREAM, PF_UNSPEC);
if (newFD == -1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to socket failed for " << label
- << " TCP socket. Error is " << EGET() << " '"
- << ESTR() << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Call to socket failed for " << label
+ << " socket. Error is " << EGET() << " '"
+ << ESTR() << "'.\n" << std::flush;
cerr << "Error" << ": Call to socket failed for " << label
- << " TCP socket. Error is " << EGET() << " '"
+ << " socket. Error is " << EGET() << " '"
<< ESTR() << "'.\n";
goto SetupSocketError;
}
- else if (SetReuseAddress(newFD) < 0)
- {
- goto SetupSocketError;
- }
- tcpAddr.sin_family = AF_INET;
- tcpAddr.sin_port = htons(portTCP);
- tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ if (addr->sa_family == AF_INET)
+ if (SetReuseAddress(newFD) < 0)
+ {
+ // SetReuseAddress already warns with an error
+ goto SetupSocketError;
+ }
- if (bind(newFD, (sockaddr *) &tcpAddr, sizeof(tcpAddr)) == -1)
+ if (bind(newFD, addr, addrlen) == -1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to bind failed for " << label
- << " TCP port " << port << ". Error is " << EGET()
- << " '" << ESTR() << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Call to bind failed for " << label
+ << ". Error is " << EGET()
+ << " '" << ESTR() << "'.\n" << std::flush;
cerr << "Error" << ": Call to bind failed for " << label
- << " TCP port " << port << ". Error is " << EGET()
+ << ". Error is " << EGET()
<< " '" << ESTR() << "'.\n";
-
goto SetupSocketError;
}
if (listen(newFD, 8) == -1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to bind failed for " << label
- << " TCP port " << port << ". Error is " << EGET()
- << " '" << ESTR() << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Call to listen failed for " << label
+ << ". Error is " << EGET()
+ << " '" << ESTR() << "'.\n" << std::flush;
- cerr << "Error" << ": Call to bind failed for " << label
- << " TCP port " << port << ". Error is " << EGET()
+ cerr << "Error" << ": Call to listen failed for " << label
+ << ". Error is " << EGET()
<< " '" << ESTR() << "'.\n";
goto SetupSocketError;
@@ -4562,6 +4214,81 @@ SetupSocketError:
//
HandleCleanup();
+ return -1;
+}
+
+int ListenConnectionUnix(const char *path, const char *label)
+{
+
+ sockaddr_un unixAddr;
+ unixAddr.sun_family = AF_UNIX;
+#ifdef UNIX_PATH_MAX
+ if (strlen(path) >= UNIX_PATH_MAX)
+#else
+ if (strlen(path) >= sizeof(unixAddr.sun_path))
+#endif
+ {
+ nxfatal << "Loop: PANIC! Socket path \"" << path << "\" for "
+ << label << " is too long.\n" << std::flush;
+
+ cerr << "Error" << ": Socket path \"" << path << "\" for "
+ << label << " is too long.\n";
+
+ HandleCleanup();
+ return -1;
+ }
+
+ strcpy(unixAddr.sun_path, path);
+ return ListenConnectionAny((sockaddr *)&unixAddr, sizeof(unixAddr), label);
+}
+
+int ListenConnectionTCP(const char *host, long port, const char *label)
+{
+ sockaddr_in tcpAddr;
+ tcpAddr.sin_family = AF_INET;
+ tcpAddr.sin_port = htons(port);
+
+ if (loopbackBind ||
+ !host ||
+ !strcmp(host, "") ||
+ !strcmp(host, "localhost")) {
+ tcpAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ }
+ else if(strcmp(host, "*") == 0) {
+ tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ }
+ else {
+ int ip = tcpAddr.sin_addr.s_addr = GetHostAddress(host);
+ if (ip == 0)
+ {
+ nxfatal << "Loop: PANIC! Unknown " << label << " host '" << host
+ << "'.\n" << std::flush;
+
+ cerr << "Error" << ": Unknown " << label << " host '" << host
+ << "'.\n";
+
+ HandleCleanup();
+ return -1;
+ }
+ }
+
+ return ListenConnectionAny((sockaddr *)&tcpAddr, sizeof(tcpAddr), label);
+}
+
+int ListenConnection(ChannelEndPoint &endpoint, const char *label)
+{
+ char *unixPath = NULL, *host = NULL;
+ long port;
+ int result = -1;
+ if (endpoint.getUnixPath(&unixPath)) {
+ result = ListenConnectionUnix(unixPath, label);
+ }
+ else if (endpoint.getTCPHostAndPort(&host, &port)) {
+ result = ListenConnectionTCP(host, port, label);
+ }
+ SAFE_FREE(unixPath);
+ SAFE_FREE(host);
+ return result;
}
static int AcceptConnection(int fd, int domain, const char *label)
@@ -4570,32 +4297,28 @@ static int AcceptConnection(int fd, int domain, const char *label)
socklen_t addrLen = sizeof(newAddr);
- #ifdef TEST
if (domain == AF_UNIX)
{
- *logofs << "Loop: Going to accept new Unix " << label
- << " connection on FD#" << fd << ".\n"
- << logofs_flush;
+ nxinfo << "Loop: Going to accept new Unix " << label
+ << " connection on FD#" << fd << ".\n"
+ << std::flush;
}
else
{
- *logofs << "Loop: Going to accept new TCP " << label
- << " connection on FD#" << fd << ".\n"
- << logofs_flush;
+ nxinfo << "Loop: Going to accept new TCP " << label
+ << " connection on FD#" << fd << ".\n"
+ << std::flush;
}
- #endif
int newFD = accept(fd, &newAddr, &addrLen);
if (newFD < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to accept failed for "
+ nxfatal << "Loop: PANIC! Call to accept failed for "
<< label << " connection. Error is " << EGET()
- << " '" << ESTR() << "'.\n" << logofs_flush;
- #endif
+ << " '" << ESTR() << "'.\n" << std::flush;
cerr << "Error" << ": Call to accept failed for "
<< label << " connection. Error is " << EGET()
@@ -4609,11 +4332,9 @@ void HandleShutdown()
{
if (proxy -> getShutdown() == 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! No shutdown of proxy link "
+ nxfatal << "Loop: PANIC! No shutdown of proxy link "
<< "performed by remote proxy.\n"
- << logofs_flush;
- #endif
+ << std::flush;
//
// Close the socket before showing the alert.
@@ -4630,11 +4351,9 @@ void HandleShutdown()
cerr << "Error" << ": Connection with remote peer broken.\n";
- #ifdef TEST
- *logofs << "Loop: Bytes received so far are "
- << (unsigned long long) statistics -> getBytesIn()
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Bytes received so far are "
+ << (unsigned long long) statistics -> getBytesIn()
+ << ".\n" << std::flush;
cerr << "Error" << ": Please check the state of your "
<< "network and retry.\n";
@@ -4643,23 +4362,19 @@ void HandleShutdown()
if (control -> ProxyMode == proxy_server)
{
- #ifdef TEST
- *logofs << "Loop: Showing the proxy abort dialog.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Showing the proxy abort dialog.\n"
+ << std::flush;
HandleAlert(ABORT_PROXY_CONNECTION_ALERT, 1);
handleAlertInLoop();
}
}
- #ifdef TEST
else
{
- *logofs << "Loop: Finalized the remote proxy shutdown.\n"
- << logofs_flush;
+ nxinfo << "Loop: Finalized the remote proxy shutdown.\n"
+ << std::flush;
}
- #endif
HandleCleanup();
}
@@ -4681,22 +4396,18 @@ int KillProcess(int pid, const char *label, int signal, int wait)
{
if (pid > 0)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Killing the " << label << " process '"
- << pid << "' from process with pid '" << getpid()
- << "' with signal '" << DumpSignal(signal)
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Killing the " << label << " process '"
+ << pid << "' from process with pid '" << getpid()
+ << "' with signal '" << DumpSignal(signal)
+ << "'.\n" << std::flush;
signal = (signal == 0 ? SIGTERM : signal);
if (kill(pid, signal) < 0 && EGET() != ESRCH)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Couldn't kill the " << label
+ nxfatal << "Loop: PANIC! Couldn't kill the " << label
<< " process with pid '" << pid << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Couldn't kill the " << label
<< " process with pid '" << pid << "'.\n";
@@ -4711,11 +4422,9 @@ int KillProcess(int pid, const char *label, int signal, int wait)
}
else
{
- #ifdef TEST
- *logofs << "Loop: No " << label << " process "
- << "to kill with pid '" << pid
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: No " << label << " process "
+ << "to kill with pid '" << pid
+ << "'.\n" << std::flush;
return 0;
}
@@ -4723,19 +4432,15 @@ int KillProcess(int pid, const char *label, int signal, int wait)
int CheckProcess(int pid, const char *label)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Checking the " << label << " process '"
- << pid << "' from process with pid '" << getpid()
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Checking the " << label << " process '"
+ << pid << "' from process with pid '" << getpid()
+ << "'.\n" << std::flush;
if (kill(pid, SIGCONT) < 0 && EGET() == ESRCH)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! The " << label << " process "
- << "with pid '" << pid << "' has exited.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! The " << label << " process "
+ << "with pid '" << pid << "' has exited.\n"
+ << std::flush;
cerr << "Warning" << ": The " << label << " process "
<< "with pid '" << pid << "' has exited.\n";
@@ -4746,23 +4451,19 @@ int CheckProcess(int pid, const char *label)
return 1;
}
-int StartKeeper()
+void StartKeeper()
{
- #if defined(TEST) || defined(INFO)
if (IsRunning(lastKeeper) == 1 ||
IsRestarting(lastKeeper) == 1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! The house-keeping process is "
+ nxfatal << "Loop: PANIC! The house-keeping process is "
<< "alreay running with pid '" << lastKeeper
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
HandleCleanup();
}
- #endif
//
// Don't care harvesting the persistent caches if
@@ -4780,53 +4481,61 @@ int StartKeeper()
if (control -> LocalTotalStorageSize > 0)
{
- #ifdef TEST
- *logofs << "Loop: Starting the house-keeping process with "
- << "storage size " << control -> PersistentCacheDiskLimit
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Starting the house-keeping process with "
+ << "storage size " << control -> PersistentCacheDiskLimit
+ << ".\n" << std::flush;
lastKeeper = NXTransKeeper(control -> PersistentCacheDiskLimit,
0, control -> RootPath);
if (IsFailed(lastKeeper))
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Failed to start the NX keeper process.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Failed to start the NX keeper process.\n"
+ << std::flush;
cerr << "Warning" << ": Failed to start the NX keeper process.\n";
SetNotRunning(lastKeeper);
}
- #ifdef TEST
else
{
- *logofs << "Loop: Keeper started with pid '"
- << lastKeeper << "'.\n" << logofs_flush;
+ nxinfo << "Loop: Keeper started with pid '"
+ << lastKeeper << "'.\n" << std::flush;
}
- #endif
}
- #ifdef TEST
else
{
- *logofs << "Loop: Nothing to do for the keeper process "
- << "with persistent cache not enabled.\n"
- << logofs_flush;
+ nxinfo << "Loop: Nothing to do for the keeper process "
+ << "with persistent cache not enabled.\n"
+ << std::flush;
}
- #endif
-
- return 1;
}
+void HandleCleanupForReconnect()
+{
+ nxinfo << "Loop: Going to clean up system resources for Reconnect "
+ << "in process '" << getpid() << "'.\n"
+ << std::flush;
+ handleTerminatedInLoop();
+ DisableSignals();
+ if (control)
+ CleanupChildren();
+ CleanupListeners();
+ CleanupSockets();
+ CleanupKeeper();
+ CleanupStreams();
+ CleanupLocal();
+ CleanupGlobal();
+ RestoreSignals();
+ ServerCache::lastInitReply.set(0,NULL);
+ ServerCache::lastKeymap.set(0,NULL);
+ ServerCache::getKeyboardMappingLastMap.set(0,NULL);
+}
void HandleCleanup(int code)
{
- #ifdef TEST
- *logofs << "Loop: Going to clean up system resources "
- << "in process '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to clean up system resources "
+ << "in process '" << getpid() << "'.\n"
+ << std::flush;
handleTerminatedInLoop();
@@ -4878,22 +4587,20 @@ void HandleCleanup(int code)
// safely exit.
//
- #ifdef TEST
if (getpid() == lastProxy)
{
- *logofs << "Loop: Reverting to loop context in process with "
- << "pid '" << getpid() << "' at " << strMsTimestamp()
- << ".\n" << logofs_flush;
+ nxinfo << "Loop: Reverting to loop context in process with "
+ << "pid '" << getpid() << "' at " << strMsTimestamp()
+ << ".\n" << std::flush;
}
else
{
- *logofs << "Loop: Exiting from child process with pid '"
- << getpid() << "' at " << strMsTimestamp()
- << ".\n" << logofs_flush;
+ nxinfo << "Loop: Exiting from child process with pid '"
+ << getpid() << "' at " << strMsTimestamp()
+ << ".\n" << std::flush;
}
- #endif
if (getpid() == lastProxy)
{
@@ -4926,11 +4633,9 @@ void CleanupKeeper()
{
if (keeper != NULL)
{
- #ifdef TEST
- *logofs << "Loop: Freeing up keeper in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Freeing up keeper in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
delete keeper;
@@ -4949,11 +4654,9 @@ void CleanupStreams()
#ifndef __CYGWIN32__
- #ifdef TEST
- *logofs << "Loop: Freeing up streams in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Freeing up streams in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
if (logofs != NULL && logofs != &cerr &&
*errorsFileName != '\0')
@@ -5049,12 +4752,10 @@ void CleanupChildren()
if (IsRunning(lastDialog))
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: WARNING! Leaving the dialog process '"
- << lastDialog << "' running in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! Leaving the dialog process '"
+ << lastDialog << "' running in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
SetNotRunning(lastDialog);
}
@@ -5065,36 +4766,30 @@ void CleanupChildren()
if (control -> EnableRestartOnShutdown == 1)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Respawning the NX client "
- << "on display '" << displayHost << "'.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Respawning the NX client "
+ << "on display '" << displayHost << "'.\n"
+ << std::flush;
NXTransClient(displayHost);
}
for (int i = 0; i < control -> KillDaemonOnShutdownNumber; i++)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Killing the NX daemon with "
- << "pid '" << control -> KillDaemonOnShutdown[i]
- << "'.\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Killing the NX daemon with "
+ << "pid '" << control -> KillDaemonOnShutdown[i]
+ << "'.\n" << std::flush;
KillProcess(control -> KillDaemonOnShutdown[i], "daemon", SIGTERM, 0);
- }
+ }
}
void CleanupGlobal()
{
if (proxy != NULL)
{
- #ifdef TEST
- *logofs << "Loop: Freeing up proxy in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Freeing up proxy in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
delete proxy;
@@ -5103,11 +4798,9 @@ void CleanupGlobal()
if (agent != NULL)
{
- #ifdef TEST
- *logofs << "Loop: Freeing up agent in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Freeing up agent in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
delete agent;
@@ -5116,11 +4809,9 @@ void CleanupGlobal()
if (auth != NULL)
{
- #ifdef TEST
- *logofs << "Loop: Freeing up auth data in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Freeing up auth data in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
delete auth;
@@ -5129,11 +4820,9 @@ void CleanupGlobal()
if (statistics != NULL)
{
- #ifdef TEST
- *logofs << "Loop: Freeing up statistics in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Freeing up statistics in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
delete statistics;
@@ -5142,11 +4831,9 @@ void CleanupGlobal()
if (control != NULL)
{
- #ifdef TEST
- *logofs << "Loop: Freeing up control in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Freeing up control in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
delete control;
@@ -5158,17 +4845,13 @@ void CleanupConnections()
{
if (proxy -> getChannels(channel_x11) != 0)
{
- #ifdef TEST
- *logofs << "Loop: Closing any remaining X connections.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing any remaining X connections.\n"
+ << std::flush;
proxy -> handleCloseAllXConnections();
- #ifdef TEST
- *logofs << "Loop: Closing any remaining listener.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing any remaining listener.\n"
+ << std::flush;
proxy -> handleCloseAllListeners();
}
@@ -5182,11 +4865,9 @@ void CleanupListeners()
{
if (tcpFD != -1)
{
- #ifdef TEST
- *logofs << "Loop: Closing TCP listener in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing TCP listener in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
close(tcpFD);
@@ -5200,11 +4881,9 @@ void CleanupListeners()
{
if (unixFD != -1)
{
- #ifdef TEST
- *logofs << "Loop: Closing UNIX listener in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing UNIX listener in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
close(unixFD);
@@ -5213,11 +4892,9 @@ void CleanupListeners()
if (*unixSocketName != '\0')
{
- #ifdef TEST
- *logofs << "Loop: Going to remove the Unix domain socket '"
- << unixSocketName << "' in process " << "with pid '"
- << getpid() << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to remove the Unix domain socket '"
+ << unixSocketName << "' in process " << "with pid '"
+ << getpid() << "'.\n" << std::flush;
unlink(unixSocketName);
}
@@ -5239,11 +4916,9 @@ void CleanupListeners()
{
if (cupsFD != -1)
{
- #ifdef TEST
- *logofs << "Loop: Closing CUPS listener in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing CUPS listener in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
close(cupsFD);
@@ -5257,11 +4932,9 @@ void CleanupListeners()
{
if (auxFD != -1)
{
- #ifdef TEST
- *logofs << "Loop: Closing auxiliary X11 listener "
- << "in process " << "with pid '" << getpid()
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing auxiliary X11 listener "
+ << "in process " << "with pid '" << getpid()
+ << "'.\n" << std::flush;
close(auxFD);
@@ -5275,11 +4948,9 @@ void CleanupListeners()
{
if (smbFD != -1)
{
- #ifdef TEST
- *logofs << "Loop: Closing SMB listener in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing SMB listener in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
close(smbFD);
@@ -5293,11 +4964,9 @@ void CleanupListeners()
{
if (mediaFD != -1)
{
- #ifdef TEST
- *logofs << "Loop: Closing multimedia listener in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing multimedia listener in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
close(mediaFD);
@@ -5311,11 +4980,9 @@ void CleanupListeners()
{
if (httpFD != -1)
{
- #ifdef TEST
- *logofs << "Loop: Closing http listener in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing http listener in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
close(httpFD);
@@ -5329,11 +4996,9 @@ void CleanupListeners()
{
if (fontFD != -1)
{
- #ifdef TEST
- *logofs << "Loop: Closing font server listener in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing font server listener in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
close(fontFD);
@@ -5347,11 +5012,9 @@ void CleanupListeners()
{
if (slaveFD != -1)
{
- #ifdef TEST
- *logofs << "Loop: Closing slave listener in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing slave listener in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
close(slaveFD);
@@ -5366,11 +5029,9 @@ void CleanupSockets()
{
if (proxyFD != -1)
{
- #ifdef TEST
- *logofs << "Loop: Closing proxy FD in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing proxy FD in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
close(proxyFD);
@@ -5379,11 +5040,9 @@ void CleanupSockets()
if (agentFD[1] != -1)
{
- #ifdef TEST
- *logofs << "Loop: Closing agent FD in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Closing agent FD in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
close(agentFD[1]);
@@ -5452,9 +5111,7 @@ void CleanupLocal()
*unixSocketName = '\0';
- *connectHost = '\0';
*acceptHost = '\0';
- *listenHost = '\0';
*displayHost = '\0';
*authCookie = '\0';
@@ -5468,15 +5125,15 @@ void CleanupLocal()
xServerAddr = NULL;
- listenPort = -1;
- connectPort = -1;
+ listenSocket.disable();
+ connectSocket.disable();
- cupsPort = -1;
- auxPort = -1;
- smbPort = -1;
- mediaPort = -1;
- httpPort = -1;
- slavePort = -1;
+ cupsPort.disable();
+ auxPort.disable();
+ smbPort.disable();
+ mediaPort.disable();
+ httpPort.disable();
+ slavePort.disable();
*fontPort = '\0';
@@ -5488,8 +5145,6 @@ void CleanupLocal()
logsTs = nullTimestamp();
nowTs = nullTimestamp();
- diffTs = 0;
-
lastProxy = 0;
lastDialog = 0;
lastWatchdog = 0;
@@ -5529,11 +5184,9 @@ int CheckAbort()
{
if (lastSignal != 0)
{
- #ifdef TEST
- *logofs << "Loop: Aborting the procedure due to signal '"
- << lastSignal << "', '" << DumpSignal(lastSignal)
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Aborting the procedure due to signal '"
+ << lastSignal << "', '" << DumpSignal(lastSignal)
+ << "'.\n" << std::flush;
cerr << "Info" << ": Aborting the procedure due to signal '"
<< lastSignal << "'.\n";
@@ -5589,10 +5242,8 @@ void HandleAbort()
raise(SIGABRT);
}
- #ifdef TEST
- *logofs << "Loop: Showing the proxy abort dialog.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Showing the proxy abort dialog.\n"
+ << std::flush;
if (control -> ProxyMode == proxy_server)
{
@@ -5624,23 +5275,19 @@ void HandleAlert(int code, int local)
{
if (lastAlert.code == 0)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Requesting an alert dialog with code "
- << code << " and local " << local << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Requesting an alert dialog with code "
+ << code << " and local " << local << ".\n"
+ << std::flush;
lastAlert.code = code;
lastAlert.local = local;
}
- #if defined(TEST) || defined(INFO)
else
{
- *logofs << "Loop: WARNING! Alert dialog already requested "
- << "with code " << lastAlert.code << ".\n"
- << logofs_flush;
+ nxinfo << "Loop: WARNING! Alert dialog already requested "
+ << "with code " << lastAlert.code << ".\n"
+ << std::flush;
}
- #endif
return;
}
@@ -5649,22 +5296,18 @@ void FlushCallback(int length)
{
if (flushCallback != NULL)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Reporting a flush request at "
- << strMsTimestamp() << " with " << length
- << " bytes written.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Reporting a flush request at "
+ << strMsTimestamp() << " with " << length
+ << " bytes written.\n" << std::flush;
(*flushCallback)(flushParameter, length);
}
- #if defined(TEST) || defined(INFO)
else if (control -> ProxyMode == proxy_client)
{
- *logofs << "Loop: WARNING! Can't find a flush "
- << "callback in process with pid '" << getpid()
- << "'.\n" << logofs_flush;
+ nxinfo << "Loop: WARNING! Can't find a flush "
+ << "callback in process with pid '" << getpid()
+ << "'.\n" << std::flush;
}
- #endif
}
void KeeperCallback()
@@ -5679,56 +5322,44 @@ void KeeperCallback()
if (control -> ImageCacheEnableLoad == 1 ||
control -> ImageCacheEnableSave == 1)
{
- #ifdef TEST
- *logofs << "Loop: Starting the house-keeping process with "
- << "image storage size " << control -> ImageCacheDiskLimit
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Starting the house-keeping process with "
+ << "image storage size " << control -> ImageCacheDiskLimit
+ << ".\n" << std::flush;
lastKeeper = NXTransKeeper(0, control -> ImageCacheDiskLimit,
control -> RootPath);
if (IsFailed(lastKeeper))
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Can't start the NX keeper process.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Can't start the NX keeper process.\n"
+ << std::flush;
SetNotRunning(lastKeeper);
}
- #ifdef TEST
else
{
- *logofs << "Loop: Keeper started with pid '"
- << lastKeeper << "'.\n" << logofs_flush;
+ nxinfo << "Loop: Keeper started with pid '"
+ << lastKeeper << "'.\n" << std::flush;
}
- #endif
}
- #ifdef TEST
else
{
- *logofs << "Loop: Nothing to do for the keeper process "
- << "with image cache not enabled.\n"
- << logofs_flush;
+ nxinfo << "Loop: Nothing to do for the keeper process "
+ << "with image cache not enabled.\n"
+ << std::flush;
}
- #endif
}
- #ifdef TEST
else
{
- *logofs << "Loop: Nothing to do with the keeper process "
- << "already running.\n" << logofs_flush;
+ nxinfo << "Loop: Nothing to do with the keeper process "
+ << "already running.\n" << std::flush;
}
- #endif
}
void InstallSignals()
{
- #ifdef TEST
- *logofs << "Loop: Installing signals in process with pid '"
- << getpid() << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Installing signals in process with pid '"
+ << getpid() << "'.\n" << std::flush;
for (int i = 0; i < 32; i++)
{
@@ -5744,10 +5375,8 @@ void InstallSignals()
void RestoreSignals()
{
- #ifdef TEST
- *logofs << "Loop: Restoring signals in process with pid '"
- << getpid() << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Restoring signals in process with pid '"
+ << getpid() << "'.\n" << std::flush;
if (lastMasks.installed == 1)
{
@@ -5790,11 +5419,9 @@ void DisableSignals()
{
if (CheckSignal(i) > 0)
{
- #ifdef DUMP
- *logofs << "Loop: Disabling signal " << i << " '"
- << DumpSignal(i) << "' in process with pid '"
- << getpid() << "'.\n" << logofs_flush;
- #endif
+ nxdbg << "Loop: Disabling signal " << i << " '"
+ << DumpSignal(i) << "' in process with pid '"
+ << getpid() << "'.\n" << std::flush;
sigaddset(&newMask, i);
}
@@ -5804,24 +5431,20 @@ void DisableSignals()
lastMasks.blocked++;
}
- #ifdef TEST
else
{
- *logofs << "Loop: WARNING! Signals were already blocked in "
- << "process with pid '" << getpid() << "'.\n"
- << logofs_flush;
+ nxinfo << "Loop: WARNING! Signals were already blocked in "
+ << "process with pid '" << getpid() << "'.\n"
+ << std::flush;
}
- #endif
}
void EnableSignals()
{
if (lastMasks.blocked == 1)
{
- #ifdef TEST
- *logofs << "Loop: Enabling signals in process with pid '"
- << getpid() << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Enabling signals in process with pid '"
+ << getpid() << "'.\n" << std::flush;
sigprocmask(SIG_SETMASK, &lastMasks.saved, NULL);
@@ -5829,11 +5452,9 @@ void EnableSignals()
}
else
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Signals were not blocked in "
- << "process with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Signals were not blocked in "
+ << "process with pid '" << getpid() << "'.\n"
+ << std::flush;
cerr << "Warning" << ": Signals were not blocked in "
<< "process with pid '" << getpid() << "'.\n";
@@ -5846,36 +5467,30 @@ void InstallSignal(int signal, int action)
{
if (action == NX_SIGNAL_FORWARD)
{
- #ifdef TEST
- *logofs << "Loop: Forwarding handler for signal " << signal
- << " '" << DumpSignal(signal) << "' in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Forwarding handler for signal " << signal
+ << " '" << DumpSignal(signal) << "' in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
lastMasks.forward[signal] = 1;
return;
}
- #ifdef TEST
else
{
- *logofs << "Loop: Reinstalling handler for signal " << signal
- << " '" << DumpSignal(signal) << "' in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
+ nxinfo << "Loop: Reinstalling handler for signal " << signal
+ << " '" << DumpSignal(signal) << "' in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
}
- #endif
}
- #ifdef TEST
else
{
- *logofs << "Loop: Installing handler for signal " << signal
- << " '" << DumpSignal(signal) << "' in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
+ nxinfo << "Loop: Installing handler for signal " << signal
+ << " '" << DumpSignal(signal) << "' in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
}
- #endif
if (signal == SIGALRM && isTimestamp(lastTimer.start))
{
@@ -5884,20 +5499,9 @@ void InstallSignal(int signal, int action)
struct sigaction newAction;
- newAction.sa_handler = HandleSignal;
-
- //
- // This field doesn't exist on most OSes except
- // Linux. We keep setting the field to NULL to
- // avoid side-effects in the case the field is
- // a value return.
- //
-
- #if defined(__linux__)
-
- newAction.sa_restorer = NULL;
+ memset(&newAction, 0, sizeof(newAction));
- #endif
+ newAction.sa_handler = HandleSignal;
sigemptyset(&(newAction.sa_mask));
@@ -5924,11 +5528,9 @@ void RestoreSignal(int signal)
{
if (lastMasks.enabled[signal] == 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Signal '" << DumpSignal(signal)
- << " not installed in process with pid '"
- << getpid() << "'.\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Signal '" << DumpSignal(signal)
+ << " not installed in process with pid '"
+ << getpid() << "'.\n" << std::flush;
cerr << "Warning" << ": Signal '" << DumpSignal(signal)
<< " not installed in process with pid '"
@@ -5937,12 +5539,10 @@ void RestoreSignal(int signal)
return;
}
- #ifdef TEST
- *logofs << "Loop: Restoring handler for signal " << signal
- << " '" << DumpSignal(signal) << "' in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Restoring handler for signal " << signal
+ << " '" << DumpSignal(signal) << "' in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
if (signal == SIGALRM && isTimestamp(lastTimer.start))
{
@@ -5962,31 +5562,27 @@ void HandleSignal(int signal)
logofs = &cerr;
}
- #if defined(UNSAFE) && (defined(TEST) || defined(INFO))
if (lastSignal != 0)
{
- *logofs << "Loop: WARNING! Last signal is '" << lastSignal
- << "', '" << DumpSignal(signal) << "' and not zero "
- << "in process with pid '" << getpid() << "'.\n"
- << logofs_flush;
+ nxinfo << "Loop: WARNING! Last signal is '" << lastSignal
+ << "', '" << DumpSignal(signal) << "' and not zero "
+ << "in process with pid '" << getpid() << "'.\n"
+ << std::flush;
}
- *logofs << "Loop: Signal '" << signal << "', '"
- << DumpSignal(signal) << "' received in process "
- << "with pid '" << getpid() << "'.\n" << logofs_flush;
+ nxinfo << "Loop: Signal '" << signal << "', '"
+ << DumpSignal(signal) << "' received in process "
+ << "with pid '" << getpid() << "'.\n" << std::flush;
- #endif
- if (getpid() != lastProxy && handler != NULL)
+ if (getpid() != lastProxy && signalHandler != NULL)
{
- #if defined(UNSAFE) && (defined(TEST) || defined(INFO))
- *logofs << "Loop: Calling slave handler in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Calling slave handler in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
- if ((*handler)(signal) == 0)
+ if ((*signalHandler)(signal) == 0)
{
return;
}
@@ -6069,15 +5665,13 @@ void HandleSignal(int signal)
// memory function if the daemon is not running.
//
- #ifdef TEST
- *logofs << "Loop: WARNING! Received signal '12' in "
- << "process with pid '" << getpid() << "'.\n"
- << logofs_flush;
+ nxinfo << "Loop: WARNING! Received signal '12' in "
+ << "process with pid '" << getpid() << "'.\n"
+ << std::flush;
- *logofs << "Loop: WARNING! Please check that the "
- << "cygserver daemon is running.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! Please check that the "
+ << "cygserver daemon is running.\n"
+ << std::flush;
break;
}
@@ -6094,12 +5688,10 @@ void HandleSignal(int signal)
if (getpid() == lastProxy)
{
- #if defined(UNSAFE) && defined(TEST)
- *logofs << "Loop: Registering end of session request "
- << "due to signal '" << signal << "', '"
- << DumpSignal(signal) << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Registering end of session request "
+ << "due to signal '" << signal << "', '"
+ << DumpSignal(signal) << "'.\n"
+ << std::flush;
lastSignal = signal;
}
@@ -6119,22 +5711,18 @@ void HandleSignal(int signal)
if (lastMasks.action[signal].sa_handler != NULL &&
lastMasks.action[signal].sa_handler != HandleSignal)
{
- #if defined(UNSAFE) && defined(TEST)
- *logofs << "Loop: Forwarding signal '" << signal << "', '"
- << DumpSignal(signal) << "' to previous handler.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Forwarding signal '" << signal << "', '"
+ << DumpSignal(signal) << "' to previous handler.\n"
+ << std::flush;
lastMasks.action[signal].sa_handler(signal);
}
- #ifdef WARNING
else if (lastMasks.action[signal].sa_handler == NULL)
{
- *logofs << "Loop: WARNING! Parent requested to forward "
- << "signal '" << signal << "', '" << DumpSignal(signal)
- << "' but didn't set a handler.\n" << logofs_flush;
+ nxwarn << "Loop: WARNING! Parent requested to forward "
+ << "signal '" << signal << "', '" << DumpSignal(signal)
+ << "' but didn't set a handler.\n" << std::flush;
}
- #endif
}
}
@@ -6148,10 +5736,8 @@ int HandleChildren()
if (IsRunning(lastDialog) && HandleChild(lastDialog) == 1)
{
- #if defined(UNSAFE) && defined(TEST)
- *logofs << "Loop: Resetting pid of last dialog process "
- << "in handler.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Resetting pid of last dialog process "
+ << "in handler.\n" << std::flush;
SetNotRunning(lastDialog);
@@ -6165,17 +5751,13 @@ int HandleChildren()
if (IsRunning(lastWatchdog) && HandleChild(lastWatchdog) == 1)
{
- #if defined(UNSAFE) && defined(TEST)
- *logofs << "Loop: Watchdog is gone. Setting the last "
- << "signal to SIGHUP.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Watchdog is gone. Setting the last "
+ << "signal to SIGHUP.\n" << std::flush;
lastSignal = SIGHUP;
- #if defined(UNSAFE) && defined(TEST)
- *logofs << "Loop: Resetting pid of last watchdog process "
- << "in handler.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Resetting pid of last watchdog process "
+ << "in handler.\n" << std::flush;
SetNotRunning(lastWatchdog);
@@ -6192,10 +5774,8 @@ int HandleChildren()
if (IsRunning(lastKeeper) && HandleChild(lastKeeper) == 1)
{
- #if defined(UNSAFE) && defined(TEST)
- *logofs << "Loop: Resetting pid of last house-keeping "
- << "process in handler.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Resetting pid of last house-keeping "
+ << "process in handler.\n" << std::flush;
SetNotRunning(lastKeeper);
@@ -6209,16 +5789,16 @@ int HandleChildren()
if (IsRunning(lastChild))
{
- #if defined(UNSAFE) && defined(TEST)
- *logofs << "Loop: Resetting pid of last child process "
- << "in handler.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Resetting pid of last child process "
+ << "in handler.\n" << std::flush;
SetNotRunning(lastChild);
return 1;
}
+ proxy->checkSlaves();
+
//
// This can actually happen either because we
// reset the pid of the child process as soon
@@ -6226,10 +5806,8 @@ int HandleChildren()
// of our parent.
//
- #if defined(UNSAFE) && (defined(TEST) || defined(INFO))
- *logofs << "Loop: Ignoring signal received for the "
- << "unregistered child.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Ignoring signal received for the "
+ << "unregistered child.\n" << std::flush;
return 0;
}
@@ -6256,11 +5834,9 @@ int WaitChild(int child, const char* label, int force)
for (;;)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Waiting for the " << label
- << " process '" << child << "' to die.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Waiting for the " << label
+ << " process '" << child << "' to die.\n"
+ << std::flush;
pid = waitpid(child, &status, options);
@@ -6271,12 +5847,10 @@ int WaitChild(int child, const char* label, int force)
return 0;
}
- #ifdef WARNING
- *logofs << "Loop: WARNING! Ignoring signal while "
- << "waiting for the " << label << " process '"
- << child << "' to die.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Ignoring signal while "
+ << "waiting for the " << label << " process '"
+ << child << "' to die.\n"
+ << std::flush;
continue;
}
@@ -6295,11 +5869,9 @@ int CheckChild(int pid, int status)
{
if (WIFSTOPPED(status))
{
- #if defined(UNSAFE) && defined(TEST)
- *logofs << "Loop: Child process '" << pid << "' was stopped "
- << "with signal " << (WSTOPSIG(status)) << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Child process '" << pid << "' was stopped "
+ << "with signal " << (WSTOPSIG(status)) << ".\n"
+ << std::flush;
return 0;
}
@@ -6307,11 +5879,9 @@ int CheckChild(int pid, int status)
{
if (WIFEXITED(status))
{
- #if defined(UNSAFE) && defined(TEST)
- *logofs << "Loop: Child process '" << pid << "' exited "
- << "with status '" << (WEXITSTATUS(status))
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Child process '" << pid << "' exited "
+ << "with status '" << (WEXITSTATUS(status))
+ << "'.\n" << std::flush;
lastStatus = WEXITSTATUS(status);
}
@@ -6319,26 +5889,22 @@ int CheckChild(int pid, int status)
{
if (CheckSignal(WTERMSIG(status)) != 1)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Child process '" << pid
- << "' died because of signal " << (WTERMSIG(status))
- << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Child process '" << pid
+ << "' died because of signal " << (WTERMSIG(status))
+ << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n"
+ << std::flush;
cerr << "Warning" << ": Child process '" << pid
<< "' died because of signal " << (WTERMSIG(status))
<< ", '" << DumpSignal(WTERMSIG(status)) << "'.\n";
}
- #if defined(UNSAFE) && defined(TEST)
else
{
- *logofs << "Loop: Child process '" << pid
- << "' died because of signal " << (WTERMSIG(status))
- << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n"
- << logofs_flush;
+ nxinfo << "Loop: Child process '" << pid
+ << "' died because of signal " << (WTERMSIG(status))
+ << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n"
+ << std::flush;
}
- #endif
lastStatus = 1;
}
@@ -6350,11 +5916,9 @@ int CheckChild(int pid, int status)
{
if (EGET() != ECHILD)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to waitpid failed. "
+ nxfatal << "Loop: PANIC! Call to waitpid failed. "
<< "Error is " << EGET() << " '" << ESTR()
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
cerr << "Error" << ": Call to waitpid failed. "
<< "Error is " << EGET() << " '" << ESTR()
@@ -6369,10 +5933,8 @@ int CheckChild(int pid, int status)
// within the call.
//
- #ifdef TEST
- *logofs << "Loop: No more children processes running.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: No more children processes running.\n"
+ << std::flush;
return 1;
}
@@ -6382,23 +5944,21 @@ int CheckChild(int pid, int status)
void RegisterChild(int child)
{
- #if defined(TEST) || defined(INFO)
if (IsNotRunning(lastChild))
{
- *logofs << "Loop: Registering child process '" << child
- << "' in process with pid '" << getpid()
- << "'.\n" << logofs_flush;
+ nxinfo << "Loop: Registering child process '" << child
+ << "' in process with pid '" << getpid()
+ << "'.\n" << std::flush;
}
else
{
- *logofs << "Loop: WARNING! Overriding registered child '"
- << lastChild << "' with new child '" << child
- << "' in process with pid '" << getpid()
- << "'.\n" << logofs_flush;
+ nxinfo << "Loop: WARNING! Overriding registered child '"
+ << lastChild << "' with new child '" << child
+ << "' in process with pid '" << getpid()
+ << "'.\n" << std::flush;
}
- #endif
lastChild = child;
}
@@ -6407,11 +5967,9 @@ int CheckParent(const char *name, const char *type, int parent)
{
if (parent != getppid() || parent == 1)
{
- #ifdef WARNING
- *logofs << name << ": WARNING! Parent process appears "
- << "to be dead. Exiting " << type << ".\n"
- << logofs_flush;
- #endif
+ nxwarn << name << ": WARNING! Parent process appears "
+ << "to be dead. Exiting " << type << ".\n"
+ << std::flush;
cerr << "Warning" << ": Parent process appears "
<< "to be dead. Exiting " << type << ".\n";
@@ -6428,11 +5986,9 @@ void HandleTimer(int signal)
{
if (isTimestamp(lastTimer.start))
{
- #if defined(UNSAFE) && defined(TEST)
- *logofs << "Loop: Timer expired at " << strMsTimestamp()
- << " in process with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Timer expired at " << strMsTimestamp()
+ << " in process with pid '" << getpid() << "'.\n"
+ << std::flush;
if (proxy != NULL)
{
@@ -6443,11 +5999,9 @@ void HandleTimer(int signal)
}
else
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Inconsistent timer state "
+ nxfatal << "Loop: PANIC! Inconsistent timer state "
<< " in process with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Inconsistent timer state "
<< " in process with pid '" << getpid() << "'.\n";
@@ -6455,12 +6009,10 @@ void HandleTimer(int signal)
}
else
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Inconsistent signal '"
+ nxfatal << "Loop: PANIC! Inconsistent signal '"
<< signal << "', '" << DumpSignal(signal)
<< "' received in process with pid '"
- << getpid() << "'.\n" << logofs_flush;
- #endif
+ << getpid() << "'.\n" << std::flush;
cerr << "Error" << ": Inconsistent signal '"
<< signal << "', '" << DumpSignal(signal)
@@ -6479,11 +6031,9 @@ void SetTimer(int value)
if (diffTs > lastTimer.next.tv_usec / 1000 * 2)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Timer missed to expire at "
- << strMsTimestamp() << " in process with pid '"
- << getpid() << "'.\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Timer missed to expire at "
+ << strMsTimestamp() << " in process with pid '"
+ << getpid() << "'.\n" << std::flush;
cerr << "Warning" << ": Timer missed to expire at "
<< strMsTimestamp() << " in process with pid '"
@@ -6493,11 +6043,9 @@ void SetTimer(int value)
}
else
{
- #ifdef TEST
- *logofs << "Loop: Timer already running at "
- << strMsTimestamp() << " in process with pid '"
- << getpid() << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Timer already running at "
+ << strMsTimestamp() << " in process with pid '"
+ << getpid() << "'.\n" << std::flush;
return;
}
@@ -6509,13 +6057,9 @@ void SetTimer(int value)
struct sigaction action;
- action.sa_handler = HandleTimer;
-
- #if defined(__linux__)
+ memset(&action, 0, sizeof(action));
- action.sa_restorer = NULL;
-
- #endif
+ action.sa_handler = HandleTimer;
sigemptyset(&action.sa_mask);
@@ -6534,21 +6078,17 @@ void SetTimer(int value)
timer.it_interval = lastTimer.next;
timer.it_value = lastTimer.next;
- #ifdef TEST
- *logofs << "Loop: Timer set to " << lastTimer.next.tv_sec
- << " S and " << lastTimer.next.tv_usec / 1000
- << " Ms at " << strMsTimestamp() << " in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Timer set to " << lastTimer.next.tv_sec
+ << " s and " << lastTimer.next.tv_usec / 1000
+ << " ms at " << strMsTimestamp() << " in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
if (setitimer(ITIMER_REAL, &timer, &lastTimer.value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to setitimer failed. "
+ nxfatal << "Loop: PANIC! Call to setitimer failed. "
<< "Error is " << EGET() << " '" << ESTR()
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
cerr << "Error" << ": Call to setitimer failed. "
<< "Error is " << EGET() << " '" << ESTR()
@@ -6566,20 +6106,16 @@ void ResetTimer()
{
if (isTimestamp(lastTimer.start) == 0)
{
- #if defined(UNSAFE) && defined(TEST)
- *logofs << "Loop: Timer not running in process "
- << "with pid '" << getpid() << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Timer not running in process "
+ << "with pid '" << getpid() << "'.\n"
+ << std::flush;
return;
}
- #if defined(UNSAFE) && defined(TEST)
- *logofs << "Loop: Timer reset at " << strMsTimestamp()
- << " in process with pid '" << getpid()
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Timer reset at " << strMsTimestamp()
+ << " in process with pid '" << getpid()
+ << "'.\n" << std::flush;
//
// Restore the old signal mask and timer.
@@ -6587,11 +6123,9 @@ void ResetTimer()
if (setitimer(ITIMER_REAL, &lastTimer.value, NULL) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to setitimer failed. "
+ nxfatal << "Loop: PANIC! Call to setitimer failed. "
<< "Error is " << EGET() << " '" << ESTR()
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
cerr << "Error" << ": Call to setitimer failed. "
<< "Error is " << EGET() << " '" << ESTR()
@@ -6600,11 +6134,9 @@ void ResetTimer()
if (sigaction(SIGALRM, &lastTimer.action, NULL) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to sigaction failed. "
+ nxfatal << "Loop: PANIC! Call to sigaction failed. "
<< "Error is " << EGET() << " '" << ESTR()
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
cerr << "Error" << ": Call to sigaction failed. "
<< "Error is " << EGET() << " '" << ESTR()
@@ -6615,144 +6147,79 @@ void ResetTimer()
}
//
-// Open TCP socket to listen for remote proxy and
-// block until remote connects. If successful close
-// the listening socket and return FD on which the
-// other party is connected.
+// Open TCP or UNIX file socket to listen for remote proxy
+// and block until remote connects. If successful close
+// the listening socket and return FD on which the other
+// party is connected.
//
-int WaitForRemote(int portNum)
+int WaitForRemote(ChannelEndPoint &socketAddress)
{
char hostLabel[DEFAULT_STRING_LENGTH] = { 0 };
+ char *socketUri = NULL;
int retryAccept = -1;
- int listenIPAddr = -1;
- int proxyFD = -1;
+ int pFD = -1;
int newFD = -1;
- //
- // Get IP address of host to be awaited.
- //
-
int acceptIPAddr = 0;
- if (*acceptHost != '\0')
- {
- acceptIPAddr = GetHostAddress(acceptHost);
-
- if (acceptIPAddr == 0)
- {
- #ifdef PANIC
- *logofs << "Loop: PANIC! Cannot accept connections from unknown host '"
- << acceptHost << "'.\n" << logofs_flush;
- #endif
-
- cerr << "Error" << ": Cannot accept connections from unknown host '"
- << acceptHost << "'.\n";
-
- goto WaitForRemoteError;
- }
- }
-
- proxyFD = socket(AF_INET, SOCK_STREAM, PF_UNSPEC);
-
- if (proxyFD == -1)
- {
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to socket failed for TCP socket. "
- << "Error is " << EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
-
- cerr << "Error" << ": Call to socket failed for TCP socket. "
- << "Error is " << EGET() << " '" << ESTR() << "'.\n";
-
- goto WaitForRemoteError;
- }
- else if (SetReuseAddress(proxyFD) < 0)
+ if (socketAddress.isTCPSocket())
{
- goto WaitForRemoteError;
- }
-
- listenIPAddr = 0;
-
- ParseListenOption(listenIPAddr);
-
- sockaddr_in tcpAddr;
-
- tcpAddr.sin_family = AF_INET;
- tcpAddr.sin_port = htons(portNum);
-
- //
- // Quick patch to run on MacOS/X where inet_addr("127.0.0.1")
- // alone seems to fail to return a valid interface. It probably
- // just needs a htonl() or something like that.
- //
- // TODO: We have to give another look at inet_addr("127.0.0.1")
- // on the Mac.
- //
-
- #ifdef __APPLE__
-
- tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY);
- #else
-
- tcpAddr.sin_addr.s_addr = listenIPAddr;
-
- #endif
-
- if (bind(proxyFD, (sockaddr *) &tcpAddr, sizeof(tcpAddr)) == -1)
- {
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to bind failed for TCP port "
- << portNum << ". Error is " << EGET() << " '" << ESTR()
- << "'.\n" << logofs_flush;
- #endif
-
- cerr << "Error" << ": Call to bind failed for TCP port "
- << portNum << ". Error is " << EGET() << " '" << ESTR()
- << "'.\n";
+ //
+ // Get IP address of host to be awaited.
+ //
- goto WaitForRemoteError;
- }
+ if (*acceptHost != '\0')
+ {
+ acceptIPAddr = GetHostAddress(acceptHost);
- if (listen(proxyFD, 4) == -1)
- {
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to listen failed for TCP port "
- << portNum << ". Error is " << EGET() << " '" << ESTR()
- << "'.\n" << logofs_flush;
- #endif
+ if (acceptIPAddr == 0)
+ {
+ nxfatal << "Loop: PANIC! Cannot accept connections from unknown host '"
+ << acceptHost << "'.\n" << std::flush;
- cerr << "Error" << ": Call to listen failed for TCP port "
- << portNum << ". Error is " << EGET() << " '" << ESTR()
- << "'.\n";
+ cerr << "Error" << ": Cannot accept connections from unknown host '"
+ << acceptHost << "'.\n";
- goto WaitForRemoteError;
- }
+ goto WaitForRemoteError;
+ }
+ snprintf(hostLabel, sizeof(hostLabel), "'%s'", acceptHost);
+ }
+ else
+ {
+ strcpy(hostLabel, "any host");
+ }
- if (*acceptHost != '\0')
- {
- strcat(hostLabel, "'");
- strcat(hostLabel, acceptHost);
- strcat(hostLabel, "'");
+ long _bindPort;
+ if (socketAddress.getTCPHostAndPort(NULL, &_bindPort))
+ {
+ socketAddress.setSpec(loopbackBind ? "localhost" : "*", _bindPort);
+ }
+ else
+ {
+ // This should never happen
+ cerr << "Error" << ": Unable to change bind host\n";
+ }
}
+ else if (socketAddress.isUnixSocket())
+ strcpy(hostLabel, "this host");
else
- {
- strcpy(hostLabel, "any host");
- }
+ strcpy(hostLabel, "unknown origin (something went wrong!!!)");
- #ifdef TEST
- *logofs << "Loop: Waiting for connection from "
- << hostLabel << " on port '" << portNum
- << "'.\n" << logofs_flush;
- #endif
+ pFD = ListenConnection(socketAddress, "NX");
+
+ socketAddress.getSpec(&socketUri);
+ nxinfo << "Loop: Waiting for connection from "
+ << hostLabel << " on socket '" << socketUri
+ << "'.\n" << std::flush;
cerr << "Info" << ": Waiting for connection from "
- << hostLabel << " on port '" << portNum
+ << hostLabel << " on socket '" << socketUri
<< "'.\n";
+ SAFE_FREE(socketUri);
//
// How many times to loop waiting for connections
@@ -6771,14 +6238,14 @@ int WaitForRemote(int portNum)
fd_set readSet;
FD_ZERO(&readSet);
- FD_SET(proxyFD, &readSet);
+ FD_SET(pFD, &readSet);
T_timestamp selectTs;
selectTs.tv_sec = 20;
selectTs.tv_usec = 0;
- int result = select(proxyFD + 1, &readSet, NULL, NULL, &selectTs);
+ int result = select(pFD + 1, &readSet, NULL, NULL, &selectTs);
getNewTimestamp();
@@ -6794,32 +6261,35 @@ int WaitForRemote(int portNum)
continue;
}
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to select failed. Error is "
+ nxfatal << "Loop: PANIC! Call to select failed. Error is "
<< EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Call to select failed. Error is "
<< EGET() << " '" << ESTR() << "'.\n";
goto WaitForRemoteError;
}
- else if (result > 0 && FD_ISSET(proxyFD, &readSet))
+ else if (result > 0 && FD_ISSET(pFD, &readSet))
{
- sockaddr_in newAddr;
- size_t addrLen = sizeof(sockaddr_in);
-
- newFD = accept(proxyFD, (sockaddr *) &newAddr, (socklen_t *) &addrLen);
+ sockaddr_in newAddrINET;
+ if (socketAddress.isUnixSocket())
+ {
+ socklen_t addrLen = sizeof(sockaddr_un);
+ newFD = accept(pFD, NULL, &addrLen);
+ }
+ else if (socketAddress.isTCPSocket())
+ {
+ socklen_t addrLen = sizeof(sockaddr_in);
+ newFD = accept(pFD, (sockaddr *) &newAddrINET, &addrLen);
+ }
if (newFD == -1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to accept failed. Error is "
+ nxfatal << "Loop: PANIC! Call to accept failed. Error is "
<< EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Call to accept failed. Error is "
<< EGET() << " '" << ESTR() << "'.\n";
@@ -6827,64 +6297,86 @@ int WaitForRemote(int portNum)
goto WaitForRemoteError;
}
- char *connectedHost = inet_ntoa(newAddr.sin_addr);
-
- if (*acceptHost == '\0' || (int) newAddr.sin_addr.s_addr == acceptIPAddr)
+ if (socketAddress.isUnixSocket())
{
- #ifdef TEST
- unsigned int connectedPort = ntohs(newAddr.sin_port);
+ char * unixPath = NULL;
+ socketAddress.getUnixPath(&unixPath);
+ nxinfo << "Loop: Accepted connection from this host on Unix file socket '"
+ << unixPath << "'.\n"
+ << std::flush;
- *logofs << "Loop: Accepted connection from '" << connectedHost
- << "' with port '" << connectedPort << "'.\n"
- << logofs_flush;
- #endif
-
- cerr << "Info" << ": Accepted connection from '"
- << connectedHost << "'.\n";
+ cerr << "Info" << ": Accepted connection from this host on Unix file socket '"
+ << unixPath << "'.\n";
+ SAFE_FREE(unixPath);
break;
}
- else
+ else if (socketAddress.isTCPSocket())
{
- #ifdef PANIC
- *logofs << "Loop: WARNING! Refusing connection from '" << connectedHost
- << "' on port '" << portNum << "'.\n" << logofs_flush;
- #endif
- cerr << "Warning" << ": Refusing connection from '"
- << connectedHost << "'.\n";
- }
+ char *connectedHost = inet_ntoa(newAddrINET.sin_addr);
- //
- // Not the best way to elude a DOS attack...
- //
+ if (*acceptHost == '\0' || (int) newAddrINET.sin_addr.s_addr == acceptIPAddr)
+ {
+
+
+ unsigned int connectedPort = ntohs(newAddrINET.sin_port);
+ nxinfo << "Loop: Accepted connection from '" << connectedHost
+ << "' with port '" << connectedPort << "'.\n"
+ << std::flush;
+
+ cerr << "Info" << ": Accepted connection from '"
+ << connectedHost << "'.\n";
+
+ break;
+ }
+ else
+ {
+ nxfatal << "Loop: WARNING! Refusing connection from '" << connectedHost
+ << "' on port '" << socketAddress.getTCPPort() << "'.\n" << std::flush;
+
+ cerr << "Warning" << ": Refusing connection from '"
+ << connectedHost << "'.\n";
+ }
- sleep(5);
+ //
+ // Not the best way to elude a DOS attack...
+ //
+
+ sleep(5);
+
+ close(newFD);
+
+ }
- close(newFD);
}
if (--retryAccept == 0)
{
- if (*acceptHost == '\0')
+ if (socketAddress.isUnixSocket())
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Connection with remote host "
+ nxfatal << "Loop: PANIC! Connection via Unix file socket from this host "
<< "could not be established.\n"
- << logofs_flush;
- #endif
+ << std::flush;
+
+ cerr << "Error" << ": Connection via Unix file socket from this host "
+ << "could not be established.\n";
+ }
+ else if (*acceptHost == '\0')
+ {
+ nxfatal << "Loop: PANIC! Connection with remote host "
+ << "could not be established.\n"
+ << std::flush;
cerr << "Error" << ": Connection with remote host "
<< "could not be established.\n";
}
else
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Connection with remote host '"
+ nxfatal << "Loop: PANIC! Connection with remote host '"
<< acceptHost << "' could not be established.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Connection with remote host '"
<< acceptHost << "' could not be established.\n";
@@ -6898,54 +6390,189 @@ int WaitForRemote(int portNum)
}
}
- close(proxyFD);
+ close(pFD);
return newFD;
WaitForRemoteError:
- close(proxyFD);
+ close(pFD);
HandleCleanup();
}
-//
-// Connect to remote proxy. If successful
-// return FD of connection, else return -1.
-//
-
-int ConnectToRemote(const char *const hostName, int portNum)
+int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout, int* proxyFileDescriptor, int* reason)
{
- int proxyFD = -1;
- int remoteIPAddr = GetHostAddress(hostName);
+ if (!proxyFileDescriptor)
+ {
+ nxfatal << "Loop: PANIC! Implementation error (PrepareProxyConnectionTCP). "
+ << "'proxyFileDescriptor' must not be a NULL pointer.\n" << std::flush;
- if (remoteIPAddr == 0)
+ cerr << "Error" << ": Implementation error (PrepareProxyConnectionTCP). "
+ << "'proxyFileDescriptor' must not be a NULL pointer.\n";
+
+ return -1;
+ }
+
+ if (!reason)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Unknown remote host '"
- << hostName << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Implementation error (PrepareProxyConnectionTCP). "
+ << "'reason' must not be a NULL pointer.\n" << std::flush;
- cerr << "Error" << ": Unknown remote host '"
- << hostName << "'.\n";
+ cerr << "Error" << ": Implementation error (PrepareProxyConnectionTCP). "
+ << "'reason' must not be a NULL pointer.\n";
+
+ return -1;
+ }
+
+ int remoteIPAddr = GetHostAddress(*hostName);
+ if (remoteIPAddr == 0)
+ {
+ nxfatal << "Loop: PANIC! Unknown remote host '"
+ << *hostName << "'.\n" << std::flush;
+ cerr << "Error" << ": Unknown remote host '"
+ << *hostName << "'.\n";
HandleCleanup();
}
- #ifdef TEST
- *logofs << "Loop: Connecting to remote host '"
- << hostName << ":" << portNum << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Connecting to remote host '"
+ << *hostName << ":" << *portNum << "'.\n"
+ << std::flush;
cerr << "Info" << ": Connecting to remote host '"
- << hostName << ":" << portNum << "'.\n"
+ << *hostName << ":" << *portNum << "'.\n"
<< logofs_flush;
+ *proxyFileDescriptor = -1;
+ *reason = -1;
+
+ sockaddr_in addr;
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(*portNum);
+ addr.sin_addr.s_addr = remoteIPAddr;
+
+ *proxyFileDescriptor = socket(AF_INET, SOCK_STREAM, PF_UNSPEC);
+ *reason = EGET();
+
+ if (*proxyFileDescriptor == -1)
+ {
+ nxfatal << "Loop: PANIC! Call to socket failed. "
+ << "Error is " << *reason << " '" << ESTR()
+ << "'.\n" << std::flush;
+
+ cerr << "Error" << ": Call to socket failed. "
+ << "Error is " << *reason << " '" << ESTR()
+ << "'.\n";
+ return -1;
+
+ }
+ else if (SetReuseAddress(*proxyFileDescriptor) < 0)
+ {
+ return -1;
+ }
+
+ //
+ // Ensure operation is timed out
+ // if there is a network problem.
+ //
+
+ if (timeout)
+ SetTimer(*timeout);
+ else
+ SetTimer(20000);
+
+ int result = connect(*proxyFileDescriptor, (sockaddr *) &addr, sizeof(sockaddr_in));
+
+ *reason = EGET();
+
+ ResetTimer();
+
+ return result;
+
+}
+
+int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFileDescriptor, int* reason)
+{
+
+ if (!proxyFileDescriptor)
+ {
+ nxfatal << "Loop: PANIC! Implementation error (PrepareProxyConnectionUnix). "
+ << "proxyFileDescriptor must not be a NULL pointer.\n" << std::flush;
+
+ cerr << "Error" << ": Implementation error (PrepareProxyConnectionUnix). "
+ << "proxyFileDescriptor must not be a NULL pointer.\n";
+
+ return -1;
+ }
+
+ if (!reason)
+ {
+ nxfatal << "Loop: PANIC! Implementation error (PrepareProxyConnectionUnix). "
+ << "'reason' must not be a NULL pointer.\n" << std::flush;
+
+ cerr << "Error" << ": Implementation error (PrepareProxyConnectionUnix). "
+ << "'reason' must not be a NULL pointer.\n";
+
+ return -1;
+ }
+
+ /* FIXME: Add socket file existence and permission checks */
+
+ *proxyFileDescriptor = -1;
+ *reason = -1;
+
+ sockaddr_un addr;
+ addr.sun_family = AF_UNIX;
+ strncpy(addr.sun_path, *path, 108 - 1);
+
+ *proxyFileDescriptor = socket(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
+ *reason = EGET();
+
+ if (*proxyFileDescriptor == -1)
+ {
+ nxfatal << "Loop: PANIC! Call to socket failed. "
+ << "Error is " << *reason << " '" << ESTR()
+ << "'.\n" << std::flush;
+
+ cerr << "Error" << ": Call to socket failed. "
+ << "Error is " << *reason << " '" << ESTR()
+ << "'.\n";
+
+ return -1;
+ }
+
+ //
+ // Ensure operation is timed out
+ // if there is a network problem.
+ //
+
+ if (timeout)
+ SetTimer(*timeout);
+ else
+ SetTimer(20000);
+
+ int result = connect(*proxyFileDescriptor, (sockaddr *) &addr, sizeof(sockaddr_un));
+
+ *reason = EGET();
+
+ ResetTimer();
+
+ return result;
+}
+
+//
+// Connect to remote proxy. If successful
+// return FD of connection, else return -1.
+//
+
+int ConnectToRemote(ChannelEndPoint &socketAddress)
+{
+
//
// How many times we retry to connect to remote
- // host in case of failure?
+ // host / Unix domain socket in case of failure?
//
int retryConnect = control -> OptionProxyRetryConnect;
@@ -6963,58 +6590,30 @@ int ConnectToRemote(const char *const hostName, int portNum)
T_timestamp lastRetry = getNewTimestamp();
- sockaddr_in addr;
+ int result = -1;
+ int reason = -1;
+ int pFD = -1;
- addr.sin_family = AF_INET;
- addr.sin_port = htons(portNum);
- addr.sin_addr.s_addr = remoteIPAddr;
+ char *hostName = NULL;
+ long int portNum = -1;
+ char *unixPath = NULL;
for (;;)
{
- proxyFD = socket(AF_INET, SOCK_STREAM, PF_UNSPEC);
-
- if (proxyFD == -1)
- {
- #ifdef PANIC
- *logofs << "Loop: PANIC! Call to socket failed. "
- << "Error is " << EGET() << " '" << ESTR()
- << "'.\n" << logofs_flush;
- #endif
-
- cerr << "Error" << ": Call to socket failed. "
- << "Error is " << EGET() << " '" << ESTR()
- << "'.\n";
-
- goto ConnectToRemoteError;
- }
- else if (SetReuseAddress(proxyFD) < 0)
- {
- goto ConnectToRemoteError;
- }
-
- //
- // Ensure operation is timed out
- // if there is a network problem.
- //
- #ifdef DEBUG
- *logofs << "Loop: Timer set to " << connectTimeout / 1000
- << " S " << "with retry set to " << retryConnect
- << " in process with pid '" << getpid()
- << "'.\n" << logofs_flush;
- #endif
-
- SetTimer(connectTimeout);
-
- int result = connect(proxyFD, (sockaddr *) &addr, sizeof(sockaddr_in));
-
- int reason = EGET();
+ nxdbg << "Loop: Timer set to " << connectTimeout / 1000
+ << " s " << "with retry set to " << retryConnect
+ << " in process with pid '" << getpid()
+ << "'.\n" << std::flush;
- ResetTimer();
+ if (socketAddress.getUnixPath(&unixPath))
+ result = PrepareProxyConnectionUnix(&unixPath, &connectTimeout, &pFD, &reason);
+ else if (socketAddress.getTCPHostAndPort(&hostName, &portNum))
+ result = PrepareProxyConnectionTCP(&hostName, &portNum, &connectTimeout, &pFD, &reason);
if (result < 0)
{
- close(proxyFD);
+ close(pFD);
if (CheckAbort() != 0)
{
@@ -7024,26 +6623,36 @@ int ConnectToRemote(const char *const hostName, int portNum)
{
ESET(reason);
- #ifdef PANIC
- *logofs << "Loop: PANIC! Connection to '" << hostName
- << ":" << portNum << "' failed. Error is "
- << EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
+ if (socketAddress.isUnixSocket())
+ {
+ nxfatal << "Loop: PANIC! Connection to Unix file socket '"
+ << unixPath << "' failed. Error is "
+ << EGET() << " '" << ESTR() << "'.\n"
+ << std::flush;
+
+ cerr << "Error" << ": Connection to Unix file socket '"
+ << unixPath << "' failed. Error is "
+ << EGET() << " '" << ESTR() << "'.\n";
+ }
+ else
+ {
- cerr << "Error" << ": Connection to '" << hostName
- << ":" << portNum << "' failed. Error is "
- << EGET() << " '" << ESTR() << "'.\n";
+ nxfatal << "Loop: PANIC! Connection to '" << hostName
+ << ":" << portNum << "' failed. Error is "
+ << EGET() << " '" << ESTR() << "'.\n"
+ << std::flush;
+ cerr << "Error" << ": Connection to '" << hostName
+ << ":" << portNum << "' failed. Error is "
+ << EGET() << " '" << ESTR() << "'.\n";
+ }
goto ConnectToRemoteError;
}
else
{
- #ifdef TEST
- *logofs << "Loop: Sleeping " << retryTimeout
- << " Ms before retrying.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Sleeping " << retryTimeout
+ << " ms before retrying.\n"
+ << std::flush;
usleep(retryTimeout * 1000);
@@ -7099,22 +6708,28 @@ int ConnectToRemote(const char *const hostName, int portNum)
lastRetry = getTimestamp();
}
}
- #ifdef TEST
{
- *logofs << "Loop: Not showing the dialog with "
- << (diffTimestamp(lastRetry, getTimestamp()) / 1000)
- << " seconds elapsed.\n" << logofs_flush;
+ nxinfo << "Loop: Not showing the dialog with "
+ << (diffTimestamp(lastRetry, getTimestamp()) / 1000)
+ << " seconds elapsed.\n" << std::flush;
}
- #endif
ESET(reason);
- #ifdef TEST
- *logofs << "Loop: Connection to '" << hostName
- << ":" << portNum << "' failed with error '"
- << ESTR() << "'. Retrying.\n"
- << logofs_flush;
- #endif
+ if (unixPath && unixPath[0] != '\0' )
+ {
+ nxinfo << "Loop: Connection to Unix socket file '"
+ << unixPath << "' failed with error '"
+ << ESTR() << "'. Retrying.\n"
+ << std::flush;
+ }
+ else
+ {
+ nxinfo << "Loop: Connection to '" << hostName
+ << ":" << portNum << "' failed with error '"
+ << ESTR() << "'. Retrying.\n"
+ << std::flush;
+ }
}
else
{
@@ -7126,13 +6741,19 @@ int ConnectToRemote(const char *const hostName, int portNum)
}
}
- return proxyFD;
+ SAFE_FREE(unixPath);
+ SAFE_FREE(hostName);
+
+ return pFD;
ConnectToRemoteError:
- if (proxyFD != -1)
+ SAFE_FREE(unixPath);
+ SAFE_FREE(hostName);
+
+ if (pFD != -1)
{
- close(proxyFD);
+ close(pFD);
}
HandleCleanup();
@@ -7154,8 +6775,11 @@ int SendProxyOptions(int fd)
// value and ignore the second.
//
- sprintf(options, "NXPROXY-1.5.0-%i.%i.%i", control -> LocalVersionMajor,
- control -> LocalVersionMinor, control -> LocalVersionPatch);
+ sprintf(options, "NXPROXY-%s-%i.%i.%i",
+ control -> NXPROXY_COMPATIBILITY_VERSION,
+ control -> LocalVersionMajor,
+ control -> LocalVersionMinor,
+ control -> LocalVersionPatch);
//
// If you want to send options from proxy
@@ -7234,8 +6858,8 @@ int SendProxyOptions(int fd)
// Add the 'strict' option, if needed.
//
- if (control -> isProtoStep7() == 1 &&
- useStrict != -1)
+ // Since ProtoStep7 (#issue 108)
+ if (useStrict != -1)
{
sprintf(options + strlen(options), "strict=%d,", useStrict);
}
@@ -7245,8 +6869,8 @@ int SendProxyOptions(int fd)
// memory segment.
//
- if (control -> isProtoStep7() == 1 &&
- *shsegSizeName != '\0')
+ // Since ProtoStep7 (#issue 108)
+ if (*shsegSizeName != '\0')
{
sprintf(options + strlen(options), "shseg=%s,", shsegSizeName);
}
@@ -7291,20 +6915,16 @@ int SendProxyOptions(int fd)
}
}
- #ifdef TEST
- *logofs << "Loop: Sending remote options '"
- << options << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Sending remote options '"
+ << options << "'.\n" << std::flush;
return WriteLocalData(fd, options, strlen(options));
}
int ReadProxyVersion(int fd)
{
- #ifdef TEST
- *logofs << "Loop: Going to read the remote proxy version "
- << "from FD#" << fd << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to read the remote proxy version "
+ << "from FD#" << fd << ".\n" << std::flush;
//
// Read until the first space in string.
@@ -7330,18 +6950,14 @@ int ReadProxyVersion(int fd)
return result;
}
- #ifdef TEST
- *logofs << "Loop: Received remote version string '"
- << options << "' from FD#" << fd << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Received remote version string '"
+ << options << "' from FD#" << fd << ".\n"
+ << std::flush;
if (strncmp(options, "NXPROXY-", strlen("NXPROXY-")) != 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Parse error in remote options string '"
- << options << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Parse error in remote options string '"
+ << options << "'.\n" << std::flush;
cerr << "Error" << ": Parse error in remote options string '"
<< options << "'.\n";
@@ -7368,11 +6984,9 @@ int ReadProxyVersion(int fd)
control -> RemoteVersionPatch == 2 &&
major != -1 && minor != -1 && patch != -1)
{
- #ifdef TEST
- *logofs << "Loop: Read trailing remote version '" << major
- << "." << minor << "." << patch << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Read trailing remote version '" << major
+ << "." << minor << "." << patch << "'.\n"
+ << std::flush;
control -> CompatVersionMajor = major;
control -> CompatVersionMinor = minor;
@@ -7396,7 +7010,6 @@ int ReadProxyVersion(int fd)
&(control -> RemoteVersionPatch));
}
- #ifdef TEST
*logofs << "Loop: Identified remote version '" << control -> RemoteVersionMajor
<< "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch
<< "'.\n" << logofs_flush;
@@ -7408,7 +7021,6 @@ int ReadProxyVersion(int fd)
*logofs << "Loop: Local version '" << control -> LocalVersionMajor
<< "." << control -> LocalVersionMinor << "." << control -> LocalVersionPatch
<< "'.\n" << logofs_flush;
- #endif
if (SetVersion() < 0)
{
@@ -7427,10 +7039,8 @@ int ReadProxyVersion(int fd)
int ReadProxyOptions(int fd)
{
- #ifdef TEST
- *logofs << "Loop: Going to read the remote proxy options "
- << "from FD#" << fd << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to read the remote proxy options "
+ << "from FD#" << fd << ".\n" << std::flush;
char options[DEFAULT_REMOTE_OPTIONS_LENGTH];
@@ -7441,11 +7051,9 @@ int ReadProxyOptions(int fd)
return result;
}
- #ifdef TEST
- *logofs << "Loop: Received remote options string '"
- << options << "' from FD#" << fd << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Received remote options string '"
+ << options << "' from FD#" << fd << ".\n"
+ << std::flush;
//
// Get the remote options, delimited by a space character.
@@ -7455,11 +7063,9 @@ int ReadProxyOptions(int fd)
if (ParseRemoteOptions(options) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Couldn't negotiate a valid "
+ nxfatal << "Loop: PANIC! Couldn't negotiate a valid "
<< "session with remote NX proxy.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Couldn't negotiate a valid "
<< "session with remote NX proxy.\n";
@@ -7472,10 +7078,8 @@ int ReadProxyOptions(int fd)
int SendProxyCaches(int fd)
{
- #ifdef TEST
- *logofs << "Loop: Synchronizing local and remote caches.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Synchronizing local and remote caches.\n"
+ << std::flush;
if (control -> ProxyMode == proxy_client)
{
@@ -7484,10 +7088,8 @@ int SendProxyCaches(int fd)
// session type and send it to the remote.
//
- #ifdef TEST
- *logofs << "Loop: Going to send the list of local caches.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to send the list of local caches.\n"
+ << std::flush;
SetCaches();
@@ -7498,20 +7100,16 @@ int SendProxyCaches(int fd)
if (control -> LocalDeltaCompression == 0 ||
control -> PersistentCacheEnableLoad == 0)
{
- #ifdef TEST
- *logofs << "Loop: Writing an empty list to FD#" << fd
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Writing an empty list to FD#" << fd
+ << ".\n" << std::flush;
return WriteLocalData(fd, "cachelist=none ", strlen("cachelist=none "));
}
int count = 0;
- #ifdef TEST
- *logofs << "Loop: Looking for cache files in directory '"
- << control -> PersistentCachePath << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Looking for cache files in directory '"
+ << control -> PersistentCachePath << "'.\n" << std::flush;
DIR *cacheDir = opendir(control -> PersistentCachePath);
@@ -7537,11 +7135,9 @@ int SendProxyCaches(int fd)
WriteLocalData(fd, ",", strlen(","));
}
- #ifdef TEST
- *logofs << "Loop: Writing entry '" << control -> PersistentCachePath
- << "/" << dirEntry -> d_name << "' to FD#" << fd
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Writing entry '" << control -> PersistentCachePath
+ << "/" << dirEntry -> d_name << "' to FD#" << fd
+ << ".\n" << std::flush;
//
// Write cache file name to the socket,
@@ -7559,10 +7155,8 @@ int SendProxyCaches(int fd)
if (count == 0)
{
- #ifdef TEST
- *logofs << "Loop: Writing an empty list to FD#" << fd
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Writing an empty list to FD#" << fd
+ << ".\n" << std::flush;
return WriteLocalData(fd, "cachelist=none ", strlen("cachelist=none "));
}
@@ -7577,20 +7171,16 @@ int SendProxyCaches(int fd)
// Send back the selected cache name.
//
- #ifdef TEST
- *logofs << "Loop: Going to send the selected cache.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to send the selected cache.\n"
+ << std::flush;
char buffer[DEFAULT_STRING_LENGTH];
if (control -> PersistentCacheName != NULL)
{
- #ifdef TEST
- *logofs << "Loop: Name of selected cache file is '"
- << control -> PersistentCacheName << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Name of selected cache file is '"
+ << control -> PersistentCacheName << "'.\n"
+ << std::flush;
sprintf(buffer, "cachefile=%s%s ",
*(control -> PersistentCacheName) == 'C' ? "S-" : "C-",
@@ -7598,19 +7188,15 @@ int SendProxyCaches(int fd)
}
else
{
- #ifdef TEST
- *logofs << "Loop: No valid cache file was selected.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: No valid cache file was selected.\n"
+ << std::flush;
sprintf(buffer, "cachefile=none ");
}
- #ifdef TEST
- *logofs << "Loop: Sending string '" << buffer
- << "' as selected cache file.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Sending string '" << buffer
+ << "' as selected cache file.\n"
+ << std::flush;
return WriteLocalData(fd, buffer, strlen(buffer));
}
@@ -7620,10 +7206,8 @@ int ReadProxyCaches(int fd)
{
if (control -> ProxyMode == proxy_client)
{
- #ifdef TEST
- *logofs << "Loop: Going to receive the selected proxy cache.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to receive the selected proxy cache.\n"
+ << std::flush;
//
// We will read the name of cache plus the stop character.
@@ -7646,11 +7230,9 @@ int ReadProxyCaches(int fd)
if (cacheName == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid cache file option '"
+ nxfatal << "Loop: PANIC! Invalid cache file option '"
<< buffer << "' provided by remote proxy.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Invalid cache file option '"
<< buffer << "' provided by remote proxy.\n";
@@ -7669,19 +7251,15 @@ int ReadProxyCaches(int fd)
if (strncasecmp(cacheName, "none", strlen("none")) == 0)
{
- #ifdef TEST
- *logofs << "Loop: No cache file selected by remote proxy.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: No cache file selected by remote proxy.\n"
+ << std::flush;
}
else if (strlen(cacheName) != MD5_LENGTH * 2 + 3 ||
*(cacheName + MD5_LENGTH * 2 + 2) != ' ')
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid cache file name '"
+ nxfatal << "Loop: PANIC! Invalid cache file name '"
<< cacheName << "' provided by remote proxy.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Invalid cache file name '"
<< cacheName << "' provided by remote proxy.\n";
@@ -7700,18 +7278,14 @@ int ReadProxyCaches(int fd)
strcpy(control -> PersistentCacheName, cacheName);
- #ifdef TEST
- *logofs << "Loop: Cache file '" << control -> PersistentCacheName
- << "' selected by remote proxy.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Cache file '" << control -> PersistentCacheName
+ << "' selected by remote proxy.\n" << std::flush;
}
}
else
{
- #ifdef TEST
- *logofs << "Loop: Going to receive the list of remote caches.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to receive the list of remote caches.\n"
+ << std::flush;
SetCaches();
@@ -7729,10 +7303,8 @@ int ReadProxyCaches(int fd)
return result;
}
- #ifdef TEST
- *logofs << "Loop: Read list of caches from remote side as '"
- << buffer << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Read list of caches from remote side as '"
+ << buffer << "'.\n" << std::flush;
//
// Prepare the buffer. What we want is a list
@@ -7744,10 +7316,8 @@ int ReadProxyCaches(int fd)
if (strncasecmp(buffer, "cachelist=", strlen("cachelist=")) != 0)
{
- #ifdef PANIC
- *logofs << "Loop: Wrong format for list of cache files "
- << "read from FD#" << fd << ".\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: Wrong format for list of cache files "
+ << "read from FD#" << fd << ".\n" << std::flush;
cerr << "Error" << ": Wrong format for list of cache files.\n";
@@ -7770,10 +7340,8 @@ int ReadProxyCaches(int fd)
int ReadForwarderVersion(int fd)
{
- #ifdef TEST
- *logofs << "Loop: Going to negotiate the forwarder version.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to negotiate the forwarder version.\n"
+ << std::flush;
//
// Check if we actually expect the session cookie.
@@ -7781,10 +7349,8 @@ int ReadForwarderVersion(int fd)
if (*authCookie == '\0')
{
- #ifdef TEST
- *logofs << "Loop: No authentication cookie required "
- << "from FD#" << fd << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: No authentication cookie required "
+ << "from FD#" << fd << ".\n" << std::flush;
return 1;
}
@@ -7798,17 +7364,13 @@ int ReadForwarderVersion(int fd)
return result;
}
- #ifdef TEST
- *logofs << "Loop: Received forwarder version string '" << options
- << "' from FD#" << fd << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Received forwarder version string '" << options
+ << "' from FD#" << fd << ".\n" << std::flush;
if (strncmp(options, "NXSSH-", strlen("NXSSH-")) != 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Parse error in forwarder options string '"
- << options << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Parse error in forwarder options string '"
+ << options << "'.\n" << std::flush;
cerr << "Error" << ": Parse error in forwarder options string '"
<< options << "'.\n";
@@ -7823,11 +7385,9 @@ int ReadForwarderVersion(int fd)
sscanf(options, "NXSSH-%i.%i.%i", &(control -> RemoteVersionMajor),
&(control -> RemoteVersionMinor), &(control -> RemoteVersionPatch));
- #ifdef TEST
- *logofs << "Loop: Read forwarder version '" << control -> RemoteVersionMajor
- << "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Read forwarder version '" << control -> RemoteVersionMajor
+ << "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch
+ << "'.\n" << std::flush;
return 1;
}
@@ -7840,10 +7400,8 @@ int ReadForwarderOptions(int fd)
if (*authCookie == '\0')
{
- #ifdef TEST
- *logofs << "Loop: No authentication cookie required "
- << "from FD#" << fd << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: No authentication cookie required "
+ << "from FD#" << fd << ".\n" << std::flush;
return 1;
}
@@ -7857,19 +7415,15 @@ int ReadForwarderOptions(int fd)
return result;
}
- #ifdef TEST
- *logofs << "Loop: Received forwarder options string '"
- << options << "' from FD#" << fd << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Received forwarder options string '"
+ << options << "' from FD#" << fd << ".\n"
+ << std::flush;
if (ParseForwarderOptions(options) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Couldn't negotiate a valid "
+ nxfatal << "Loop: PANIC! Couldn't negotiate a valid "
<< "cookie with the NX forwarder.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Couldn't negotiate a valid "
<< "cookie with the NX forwarder.\n";
@@ -7882,17 +7436,13 @@ int ReadForwarderOptions(int fd)
int ReadRemoteData(int fd, char *buffer, int size, char stop)
{
- #ifdef TEST
- *logofs << "Loop: Going to read remote data from FD#"
- << fd << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to read remote data from FD#"
+ << fd << ".\n" << std::flush;
if (size >= MAXIMUM_REMOTE_OPTIONS_LENGTH)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Maximum remote options buffer "
- << "limit exceeded.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Maximum remote options buffer "
+ << "limit exceeded.\n" << std::flush;
cerr << "Error" << ": Maximum remote options buffer "
<< "limit exceeded.\n";
@@ -7912,10 +7462,8 @@ int ReadRemoteData(int fd, char *buffer, int size, char stop)
{
if (EGET() == EAGAIN)
{
- #ifdef TEST
- *logofs << "Loop: Reading data from FD#" << fd
- << " would block.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Reading data from FD#" << fd
+ << " would block.\n" << std::flush;
return 0;
}
@@ -7930,10 +7478,8 @@ int ReadRemoteData(int fd, char *buffer, int size, char stop)
}
}
- #ifdef PANIC
- *logofs << "Loop: PANIC! The remote NX proxy closed "
- << "the connection.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! The remote NX proxy closed "
+ << "the connection.\n" << std::flush;
cerr << "Error" << ": The remote NX proxy closed "
<< "the connection.\n";
@@ -7942,10 +7488,8 @@ int ReadRemoteData(int fd, char *buffer, int size, char stop)
}
else if (*(remoteData + remotePosition) == stop)
{
- #ifdef TEST
- *logofs << "Loop: Read stop character from FD#"
- << fd << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Read stop character from FD#"
+ << fd << ".\n" << std::flush;
remotePosition++;
@@ -7958,11 +7502,9 @@ int ReadRemoteData(int fd, char *buffer, int size, char stop)
memcpy(buffer, remoteData, remotePosition + 1);
- #ifdef TEST
- *logofs << "Loop: Remote string '" << remoteData
- << "' read from FD#" << fd << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Remote string '" << remoteData
+ << "' read from FD#" << fd << ".\n"
+ << std::flush;
int t = remotePosition;
@@ -7979,12 +7521,10 @@ int ReadRemoteData(int fd, char *buffer, int size, char stop)
if (isgraph(*(remoteData + remotePosition)) == 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Non printable character decimal '"
- << (unsigned int) *(remoteData + remotePosition)
- << "' received in remote data from FD#"
- << fd << ".\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Non printable character decimal '"
+ << (unsigned int) *(remoteData + remotePosition)
+ << "' received in remote data from FD#"
+ << fd << ".\n" << std::flush;
cerr << "Warning" << ": Non printable character decimal '"
<< (unsigned int) *(remoteData + remotePosition)
@@ -7994,11 +7534,9 @@ int ReadRemoteData(int fd, char *buffer, int size, char stop)
*(remoteData + remotePosition) = ' ';
}
- #ifdef DEBUG
- *logofs << "Loop: Read a further character "
- << "from FD#" << fd << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Read a further character "
+ << "from FD#" << fd << ".\n"
+ << std::flush;
remotePosition++;
}
@@ -8006,12 +7544,10 @@ int ReadRemoteData(int fd, char *buffer, int size, char stop)
*(remoteData + remotePosition) = '\0';
- #ifdef PANIC
- *logofs << "Loop: PANIC! Stop character missing "
+ nxfatal << "Loop: PANIC! Stop character missing "
<< "from FD#" << fd << " after " << remotePosition
<< " characters read in string '" << remoteData
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
cerr << "Error" << ": Stop character missing "
<< "from FD#" << fd << " after " << remotePosition
@@ -8025,27 +7561,88 @@ int ReadRemoteData(int fd, char *buffer, int size, char stop)
return -1;
}
+static int
+hexval(char c) {
+ if ((c >= '0') && (c <= '9'))
+ return c - '0';
+ if ((c >= 'a') && (c <= 'f'))
+ return c - 'a' + 10;
+ if ((c >= 'A') && (c <= 'F'))
+ return c - 'A' + 10;
+ return -1;
+}
+
+static void
+URLDecodeInPlace(char *str) {
+ if (str) {
+ char *to = str;
+ while (str[0]) {
+ if ((str[0] == '%') &&
+ (hexval(str[1]) >= 0) &&
+ (hexval(str[2]) >= 0)) {
+ *(to++) = hexval(str[1]) * 16 + hexval(str[2]);
+ str += 3;
+ }
+ else
+ *(to++) = *(str++);
+ }
+ *to = '\0';
+ }
+}
+
int WriteLocalData(int fd, const char *buffer, int size)
{
int position = 0;
+ int ret = 0;
+ fd_set writeSet;
+ struct timeval selectTs = {30, 0};
while (position < size)
{
+
+ // A write to a non-blocking socket may fail with EAGAIN. The problem is
+ // that cache data is done in several writes, and there's no easy way
+ // to handle failure without rewriting a significant amount of code.
+ //
+ // Bailing out of the outer loop would result in restarting the sending
+ // of the entire cache list, which would confuse the other side.
+
+ FD_ZERO(&writeSet);
+ FD_SET(fd, &writeSet);
+
+ ret = select(fd+1, NULL, &writeSet, NULL, &selectTs);
+
+ nxdbg << "Loop: WriteLocalData: select() returned with a code of " << ret << " and remaining timeout of "
+ << selectTs.tv_sec << " sec, " << selectTs.tv_usec << "usec\n" << std::flush;
+
+ if ( ret < 0 )
+ {
+ *logofs << "Loop: Error in select() when writing data to FD#" << fd << ": " << strerror(EGET()) << "\n" << logofs_flush;
+
+ if ( EGET() == EINTR )
+ continue;
+
+ return -1;
+ }
+ else if ( ret == 0 )
+ {
+ *logofs << "Loop: Timeout expired in select() when writing data to FD#" << fd << ": " << strerror(EGET()) << "\n" << logofs_flush;
+ return -1;
+ }
+
int result = write(fd, buffer + position, size - position);
getNewTimestamp();
if (result <= 0)
{
- if (result < 0 && EGET() == EINTR)
+ if (result < 0 && (EGET() == EINTR || EGET() == EAGAIN || EGET() == EWOULDBLOCK))
{
continue;
}
- #ifdef TEST
- *logofs << "Loop: Error writing data to FD#"
- << fd << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Error writing data to FD#"
+ << fd << ".\n" << std::flush;
return -1;
}
@@ -8088,42 +7685,34 @@ int ParseEnvironmentOptions(const char *env, int force)
if (setjmp(context) == 1)
{
- #ifdef TEST
- *logofs << "Loop: Out of the long jump while parsing "
- << "the environment options.\n"
- << logofs_flush;
- #endif
-
+ nxinfo << "Loop: Out of the long jump while parsing "
+ << "the environment options.\n"
+ << std::flush;
+
return -1;
}
if (force == 0 && parsedOptions == 1)
{
- #ifdef TEST
- *logofs << "Loop: Skipping a further parse of environment "
- << "options string '" << (env != NULL ? env : "")
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Skipping a further parse of environment "
+ << "options string '" << (env != NULL ? env : "")
+ << "'.\n" << std::flush;
return 1;
}
if (env == NULL || *env == '\0')
{
- #ifdef TEST
- *logofs << "Loop: Nothing to do with empty environment "
- << "options string '" << (env != NULL ? env : "")
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Nothing to do with empty environment "
+ << "options string '" << (env != NULL ? env : "")
+ << "'.\n" << std::flush;
return 0;
}
- #ifdef TEST
- *logofs << "Loop: Going to parse the environment options "
- << "string '" << env << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to parse the environment options "
+ << "string '" << env << "'.\n"
+ << std::flush;
parsedOptions = 1;
@@ -8142,11 +7731,9 @@ int ParseEnvironmentOptions(const char *env, int force)
if (strlen(env) >= DEFAULT_DISPLAY_OPTIONS_LENGTH)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Environment options string '" << env
+ nxfatal << "Loop: PANIC! Environment options string '" << env
<< "' exceeds length of " << DEFAULT_DISPLAY_OPTIONS_LENGTH
- << " characters.\n" << logofs_flush;
- #endif
+ << " characters.\n" << std::flush;
cerr << "Error" << ": Environment options string '" << env
<< "' exceeds length of " << DEFAULT_DISPLAY_OPTIONS_LENGTH
@@ -8168,10 +7755,8 @@ int ParseEnvironmentOptions(const char *env, int force)
if (strncasecmp(opts, "nx/nx,:", 7) == 0 ||
strncasecmp(opts, "nx,:", 4) == 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Parse error in options string '"
- << opts << "' at 'nx,:'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Parse error in options string '"
+ << opts << "' at 'nx,:'.\n" << std::flush;
cerr << "Error" << ": Parse error in options string '"
<< opts << "' at 'nx,:'.\n";
@@ -8192,10 +7777,8 @@ int ParseEnvironmentOptions(const char *env, int force)
}
else if (force == 0)
{
- #ifdef TEST
- *logofs << "Loop: Ignoring host X server display string '"
- << opts << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Ignoring host X server display string '"
+ << opts << "'.\n" << std::flush;
return 0;
}
@@ -8217,7 +7800,7 @@ int ParseEnvironmentOptions(const char *env, int force)
char *name;
char *value;
- value = rindex(nextOpts, ':');
+ value = strrchr(nextOpts, ':');
if (value != NULL)
{
@@ -8225,10 +7808,8 @@ int ParseEnvironmentOptions(const char *env, int force)
if (*check == '\0' || isdigit(*check) == 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify NX port in string '"
- << value << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't identify NX port in string '"
+ << value << "'.\n" << std::flush;
cerr << "Error" << ": Can't identify NX port in string '"
<< value << "'.\n";
@@ -8251,10 +7832,8 @@ int ParseEnvironmentOptions(const char *env, int force)
// the port on the command line.
//
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify NX port in string '"
- << opts << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't identify NX port in string '"
+ << opts << "'.\n" << std::flush;
cerr << "Error" << ": Can't identify NX port in string '"
<< opts << "'.\n";
@@ -8262,10 +7841,8 @@ int ParseEnvironmentOptions(const char *env, int force)
return -1;
}
- #ifdef TEST
- *logofs << "Loop: Parsing options string '"
- << nextOpts << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Parsing options string '"
+ << nextOpts << "'.\n" << std::flush;
//
// Now all the other optional parameters.
@@ -8273,9 +7850,13 @@ int ParseEnvironmentOptions(const char *env, int force)
name = strtok(nextOpts, "=");
+ char connectHost[DEFAULT_STRING_LENGTH] = { 0 };
+ long connectPort = -1;
+
while (name)
{
value = strtok(NULL, ",");
+ URLDecodeInPlace(value);
if (CheckArg("environment", name, value) < 0)
{
@@ -8292,21 +7873,20 @@ int ParseEnvironmentOptions(const char *env, int force)
}
else if (strcasecmp(name, "link") == 0)
{
+
if (control -> ProxyMode == proxy_server)
{
PrintOptionIgnored("local", name, value);
}
else if (ParseLinkOption(value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify 'link' option in string '"
- << value << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't identify 'link' option in string '"
+ << value << "'.\n" << std::flush;
cerr << "Error" << ": Can't identify 'link' option in string '"
<< value << "'.\n";
-
- return -1;
+ if (ParseLinkOption("adsl") < 0)
+ return -1;
}
}
else if (strcasecmp(name, "limit") == 0)
@@ -8317,10 +7897,8 @@ int ParseEnvironmentOptions(const char *env, int force)
}
else if (ParseBitrateOption(value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify option 'limit' in string '"
- << value << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't identify option 'limit' in string '"
+ << value << "'.\n" << std::flush;
cerr << "Error" << ": Can't identify option 'limit' in string '"
<< value << "'.\n";
@@ -8353,45 +7931,50 @@ int ParseEnvironmentOptions(const char *env, int force)
}
else if (strcasecmp(name, "listen") == 0)
{
- if (*connectHost != '\0')
+ char *socketUri = NULL;
+ if (connectSocket.getSpec(&socketUri))
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't handle 'listen' and 'connect' parameters "
- << "at the same time.\n" << logofs_flush;
+ nxfatal << "Loop: PANIC! Can't handle 'listen' and 'connect' parameters "
+ << "at the same time.\n" << std::flush;
- *logofs << "Loop: PANIC! Refusing 'listen' parameter with 'connect' being '"
- << connectHost << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Refusing 'listen' parameter with 'connect' being '"
+ << socketUri << "'.\n" << std::flush;
cerr << "Error" << ": Can't handle 'listen' and 'connect' parameters "
<< "at the same time.\n";
cerr << "Error" << ": Refusing 'listen' parameter with 'connect' being '"
- << connectHost << "'.\n";
+ << socketUri << "'.\n";
+ SAFE_FREE(socketUri);
return -1;
}
- listenPort = ValidateArg("local", name, value);
+ SetAndValidateChannelEndPointArg("local", name, value, listenSocket);
+
+ }
+ else if (strcasecmp(name, "loopback") == 0)
+ {
+ loopbackBind = ValidateArg("local", name, value);
}
else if (strcasecmp(name, "accept") == 0)
{
- if (*connectHost != '\0')
+ char *socketUri = NULL;
+ if (connectSocket.getSpec(&socketUri))
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't handle 'accept' and 'connect' parameters "
- << "at the same time.\n" << logofs_flush;
+ nxfatal << "Loop: PANIC! Can't handle 'accept' and 'connect' parameters "
+ << "at the same time.\n" << std::flush;
- *logofs << "Loop: PANIC! Refusing 'accept' parameter with 'connect' being '"
- << connectHost << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Refusing 'accept' parameter with 'connect' being '"
+ << socketUri << "'.\n" << std::flush;
cerr << "Error" << ": Can't handle 'accept' and 'connect' parameters "
<< "at the same time.\n";
cerr << "Error" << ": Refusing 'accept' parameter with 'connect' being '"
- << connectHost << "'.\n";
+ << socketUri << "'.\n";
+ SAFE_FREE(socketUri);
return -1;
}
@@ -8401,13 +7984,11 @@ int ParseEnvironmentOptions(const char *env, int force)
{
if (*acceptHost != '\0')
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't handle 'connect' and 'accept' parameters "
- << "at the same time.\n" << logofs_flush;
+ nxfatal << "Loop: PANIC! Can't handle 'connect' and 'accept' parameters "
+ << "at the same time.\n" << std::flush;
- *logofs << "Loop: PANIC! Refusing 'connect' parameter with 'accept' being '"
- << acceptHost << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Refusing 'connect' parameter with 'accept' being '"
+ << acceptHost << "'.\n" << std::flush;
cerr << "Error" << ": Can't handle 'connect' and 'accept' parameters "
<< "at the same time.\n";
@@ -8417,8 +7998,12 @@ int ParseEnvironmentOptions(const char *env, int force)
return -1;
}
-
- strncpy(connectHost, value, DEFAULT_STRING_LENGTH - 1);
+ if ((strncmp(value, "tcp:", 4) == 0) || (strncmp(value, "unix:", 5) == 0))
+ SetAndValidateChannelEndPointArg("local", name, value, connectSocket);
+ else
+ // if the "connect" parameter does not start with "unix:" or "tcp:" assume
+ // old parameter usage style (providing hostname string only).
+ strcpy(connectHost, value);
}
else if (strcasecmp(name, "port") == 0)
{
@@ -8550,10 +8135,8 @@ int ParseEnvironmentOptions(const char *env, int force)
}
else if (ParseCacheOption(value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify cache size for string '"
- << value << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't identify cache size for string '"
+ << value << "'.\n" << std::flush;
cerr << "Error" << ": Can't identify cache size for string '"
<< value << "'.\n";
@@ -8569,10 +8152,8 @@ int ParseEnvironmentOptions(const char *env, int force)
}
else if (ParseImagesOption(value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify images cache size for string '"
- << value << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't identify images cache size for string '"
+ << value << "'.\n" << std::flush;
cerr << "Error" << ": Can't identify images cache size for string '"
<< value << "'.\n";
@@ -8597,11 +8178,9 @@ int ParseEnvironmentOptions(const char *env, int force)
}
else if (ParseShmemOption(value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify size of shared memory "
+ nxfatal << "Loop: PANIC! Can't identify size of shared memory "
<< "segment in string '" << value << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Can't identify size of shared memory "
<< "segment in string '" << value << "'.\n";
@@ -8665,37 +8244,35 @@ int ParseEnvironmentOptions(const char *env, int force)
}
else if (strcasecmp(name, "cups") == 0)
{
- cupsPort = ValidateArg("local", name, value);
+ SetAndValidateChannelEndPointArg("local", name, value, cupsPort);
}
else if (strcasecmp(name, "sync") == 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! No 'sync' channel in current version. "
- << "Assuming 'cups' channel.\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! No 'sync' channel in current version. "
+ << "Assuming 'cups' channel.\n" << std::flush;
cerr << "Warning" << ": No 'sync' channel in current version. "
<< "Assuming 'cups' channel.\n";
- cupsPort = ValidateArg("local", name, value);
+ SetAndValidateChannelEndPointArg("local", name, value, cupsPort);
}
else if (strcasecmp(name, "keybd") == 0 ||
strcasecmp(name, "aux") == 0)
{
- auxPort = ValidateArg("local", name, value);
+ SetAndValidateChannelEndPointArg("local", name, value, auxPort);
}
else if (strcasecmp(name, "samba") == 0 ||
strcasecmp(name, "smb") == 0)
{
- smbPort = ValidateArg("local", name, value);
+ SetAndValidateChannelEndPointArg("local", name, value, smbPort);
}
else if (strcasecmp(name, "media") == 0)
{
- mediaPort = ValidateArg("local", name, value);
+ SetAndValidateChannelEndPointArg("local", name, value, mediaPort);
}
else if (strcasecmp(name, "http") == 0)
{
- httpPort = ValidateArg("local", name, value);
+ SetAndValidateChannelEndPointArg("local", name, value, httpPort);
}
else if (strcasecmp(name, "font") == 0)
{
@@ -8703,7 +8280,7 @@ int ParseEnvironmentOptions(const char *env, int force)
}
else if (strcasecmp(name, "slave") == 0)
{
- slavePort = ValidateArg("local", name, value);
+ SetAndValidateChannelEndPointArg("local", name, value, slavePort);
}
else if (strcasecmp(name, "mask") == 0)
{
@@ -8715,10 +8292,8 @@ int ParseEnvironmentOptions(const char *env, int force)
if (timeout == 0)
{
- #ifdef TEST
- *logofs << "Loop: Disabling timeout on broken "
- << "proxy connection.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Disabling timeout on broken "
+ << "proxy connection.\n" << std::flush;
control -> ProxyTimeout = 0;
}
@@ -8733,10 +8308,8 @@ int ParseEnvironmentOptions(const char *env, int force)
if (cleanup == 0)
{
- #ifdef TEST
- *logofs << "Loop: Disabling grace timeout on "
- << "proxy shutdown.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Disabling grace timeout on "
+ << "proxy shutdown.\n" << std::flush;
control -> CleanupTimeout = 0;
}
@@ -8753,15 +8326,13 @@ int ParseEnvironmentOptions(const char *env, int force)
}
else if (ParsePackOption(value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify pack method for string '"
- << value << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't identify pack method for string '"
+ << value << "'.\n" << std::flush;
cerr << "Error" << ": Can't identify pack method for string '"
<< value << "'.\n";
-
- return -1;
+ if (ParsePackOption("nopack")<0)
+ return -1;
}
}
else if (strcasecmp(name, "core") == 0)
@@ -8773,12 +8344,10 @@ int ParseEnvironmentOptions(const char *env, int force)
if (control -> KillDaemonOnShutdownNumber <
control -> KillDaemonOnShutdownLimit)
{
- #ifdef TEST
- *logofs << "Loop: WARNING! Adding process with pid '"
- << ValidateArg("local", name, value) << " to the "
- << "daemons to kill at shutdown.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! Adding process with pid '"
+ << ValidateArg("local", name, value) << " to the "
+ << "daemons to kill at shutdown.\n"
+ << std::flush;
control -> KillDaemonOnShutdown[control ->
KillDaemonOnShutdownNumber] =
@@ -8788,10 +8357,8 @@ int ParseEnvironmentOptions(const char *env, int force)
}
else
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Number of daemons to kill "
- << "at shutdown exceeded.\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Number of daemons to kill "
+ << "at shutdown exceeded.\n" << std::flush;
cerr << "Warning" << ": Number of daemons to kill "
<< "at shutdown exceeded.\n";
@@ -8823,13 +8390,13 @@ int ParseEnvironmentOptions(const char *env, int force)
strcasecmp(name, "keyboard") == 0 ||
strcasecmp(name, "clipboard") == 0 ||
strcasecmp(name, "streaming") == 0 ||
- strcasecmp(name, "backingstore") == 0)
+ strcasecmp(name, "backingstore") == 0 ||
+ strcasecmp(name, "sleep") == 0 ||
+ strcasecmp(name, "tolerancechecks") == 0)
{
- #ifdef DEBUG
- *logofs << "Loop: Ignoring agent option '" << name
- << "' with value '" << value << "'.\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Ignoring agent option '" << name
+ << "' with value '" << value << "'.\n"
+ << std::flush;
}
else if (strcasecmp(name, "composite") == 0 ||
strcasecmp(name, "shmem") == 0 ||
@@ -8839,31 +8406,27 @@ int ParseEnvironmentOptions(const char *env, int force)
strcasecmp(name, "shadow") == 0 ||
strcasecmp(name, "shadowuid") == 0 ||
strcasecmp(name, "shadowmode") == 0 ||
- strcasecmp(name, "clients") == 0)
+ strcasecmp(name, "clients") == 0 ||
+ strcasecmp(name, "xinerama") == 0)
{
- #ifdef DEBUG
- *logofs << "Loop: Ignoring agent option '" << name
- << "' with value '" << value << "'.\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Ignoring agent option '" << name
+ << "' with value '" << value << "'.\n"
+ << std::flush;
}
else if (strcasecmp(name, "defer") == 0 ||
strcasecmp(name, "tile") == 0 ||
- strcasecmp(name, "menu") == 0)
+ strcasecmp(name, "menu") == 0 ||
+ strcasecmp(name, "state") == 0 )
{
- #ifdef DEBUG
- *logofs << "Loop: Ignoring agent option '" << name
- << "' with value '" << value << "'.\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Ignoring agent option '" << name
+ << "' with value '" << value << "'.\n"
+ << std::flush;
}
else
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Ignoring unknown option '"
- << name << "' with value '" << value << "'.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Ignoring unknown option '"
+ << name << "' with value '" << value << "'.\n"
+ << std::flush;
cerr << "Warning" << ": Ignoring unknown option '"
<< name << "' with value '" << value << "'.\n";
@@ -8873,43 +8436,46 @@ int ParseEnvironmentOptions(const char *env, int force)
} // End of while (name) ...
- #ifdef TEST
- *logofs << "Loop: Completed parsing of string '"
- << env << "'.\n" << logofs_flush;
- #endif
+ // Assemble the connectSocket channel end point if parameter values have been old-school...
+ if (connectSocket.disabled() && (connectHost[0] != '\0') && (proxyPort > 0 || connectPort > 0))
+ {
+ if (connectPort < 0)
+ connectPort = proxyPort + DEFAULT_NX_PROXY_PORT_OFFSET;
+
+ char tcpHostAndPort[DEFAULT_STRING_LENGTH] = { 0 };
+ sprintf(tcpHostAndPort, "tcp:%s:%ld", connectHost, connectPort);
+ SetAndValidateChannelEndPointArg("local", name, tcpHostAndPort, connectSocket);
+ }
+
+ nxinfo << "Loop: Completed parsing of string '"
+ << env << "'.\n" << std::flush;
- if (*fileOptions != '\0')
+ if ((*fileOptions != '\0') && (strncmp(fileOptions, "/dev/", 5) != 0) && (strncmp(fileOptions, "/proc/", 6) != 0) && (strncmp(fileOptions, "/sys/", 5) != 0))
{
if (strcmp(fileOptions, optionsFileName) != 0)
{
- #ifdef TEST
- *logofs << "Loop: Reading options from '" << fileOptions
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Reading options from '" << fileOptions
+ << "'.\n" << std::flush;
if (ParseFileOptions(fileOptions) < 0)
{
return -1;
}
}
- #ifdef WARNING
else
{
- *logofs << "Loop: WARNING! Name of the options file "
- << "specified multiple times. Not parsing "
- << "again.\n" << logofs_flush;
+ nxwarn << "Loop: WARNING! Name of the options file "
+ << "specified multiple times. Not parsing "
+ << "again.\n" << std::flush;
}
- #endif
if (*optionsFileName == '\0')
{
strncpy(optionsFileName, value, DEFAULT_STRING_LENGTH - 1);
- #ifdef TEST
- *logofs << "Loop: Assuming name of options file '"
- << optionsFileName << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming name of options file '"
+ << optionsFileName << "'.\n"
+ << std::flush;
}
}
@@ -8949,12 +8515,10 @@ int ParseCommandLineOptions(int argc, const char **argv)
if (setjmp(context) == 1)
{
- #ifdef TEST
- *logofs << "Loop: Out of the long jump while parsing "
- << "the command line options.\n"
- << logofs_flush;
- #endif
-
+ nxinfo << "Loop: Out of the long jump while parsing "
+ << "the command line options.\n"
+ << std::flush;
+
return -1;
}
@@ -8969,18 +8533,14 @@ int ParseCommandLineOptions(int argc, const char **argv)
if (parsedCommand == 1)
{
- #ifdef TEST
- *logofs << "Loop: Skipping a further parse of command line options.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Skipping a further parse of command line options.\n"
+ << std::flush;
return 1;
}
- #ifdef TEST
- *logofs << "Loop: Going to parse the command line options.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to parse the command line options.\n"
+ << std::flush;
parsedCommand = 1;
@@ -8988,17 +8548,15 @@ int ParseCommandLineOptions(int argc, const char **argv)
// Print out arguments.
//
- #ifdef TEST
- *logofs << "Loop: Argc is " << argc << ".\n" << logofs_flush;
+ nxinfo << "Loop: Argc is " << argc << ".\n" << std::flush;
for (int argi = 0; argi < argc; argi++)
{
- *logofs << "Loop: Argv[" << argi << "] is " << argv[argi]
- << ".\n" << logofs_flush;
+ nxinfo << "Loop: Argv[" << argi << "] is " << argv[argi]
+ << ".\n" << std::flush;
}
- #endif
//
// Shall use getopt here.
@@ -9026,19 +8584,15 @@ int ParseCommandLineOptions(int argc, const char **argv)
if (WE_SET_PROXY_MODE == 0)
{
- #ifdef TEST
- *logofs << "Loop: Setting local proxy mode to proxy_client.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting local proxy mode to proxy_client.\n"
+ << std::flush;
control -> ProxyMode = proxy_client;
}
else if (control -> ProxyMode != proxy_client)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't redefine local proxy to "
- << "client mode.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't redefine local proxy to "
+ << "client mode.\n" << std::flush;
cerr << "Error" << ": Can't redefine local proxy to "
<< "client mode.\n";
@@ -9056,19 +8610,15 @@ int ParseCommandLineOptions(int argc, const char **argv)
if (WE_SET_PROXY_MODE == 0)
{
- #ifdef TEST
- *logofs << "Loop: Setting local proxy mode to proxy_server.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting local proxy mode to proxy_server.\n"
+ << std::flush;
control -> ProxyMode = proxy_server;
}
else if (control -> ProxyMode != proxy_server)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't redefine local proxy to "
- << "server mode.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't redefine local proxy to "
+ << "server mode.\n" << std::flush;
cerr << "Error" << ": Can't redefine local proxy to "
<< "server mode.\n";
@@ -9084,6 +8634,102 @@ int ParseCommandLineOptions(int argc, const char **argv)
return -1;
}
+ case 'd':
+ {
+ if ( argi+1 >= argc )
+ {
+ PrintUsageInfo(nextArg, 0);
+ return -1;
+ }
+
+ int level = 0;
+ errno = 0;
+ level = strtol(argv[argi+1], NULL, 10);
+
+ if ( errno && (level == 0) )
+ {
+ cerr << "Warning: Failed to parse log level. Ignoring option." << std::endl;
+ }
+ if ( level < 0 )
+ {
+ cerr << "Warning: Log level must be a positive integer. Ignoring option." << std::endl;
+ level = nx_log.level();
+ }
+ else if ( level >= NXLOG_LEVEL_COUNT )
+ {
+ cerr << "Warning: Log level is greater than the maximum " << NXLOG_LEVEL_COUNT-1 << ". Setting to the maximum." << std::endl;
+ level = NXLOG_LEVEL_COUNT-1;
+ }
+
+ nx_log.level( (NXLogLevel)level );
+
+ argi++;
+ break;
+
+ }
+ case 'o':
+ {
+ if ( argi + 1 >= argc )
+ {
+ PrintUsageInfo(nextArg, 0);
+ return -1;
+ }
+
+ std::ofstream *logfile = new std::ofstream();
+
+ // Unbuffered output
+ logfile->rdbuf()->pubsetbuf(0, 0);
+ logfile->open(argv[argi+1], std::ofstream::app);
+
+ if ( logfile->is_open() )
+ {
+ nx_log.stream(logfile);
+ }
+ else
+ {
+ cerr << "Failed to open log file " << argv[argi+1] << endl;
+ return -1;
+ }
+
+ argi++;
+ break;
+ }
+ case 'f':
+ {
+ if ( argi + 1 >= argc )
+ {
+ PrintUsageInfo(nextArg, 0);
+ return -1;
+ }
+
+ const char *format = argv[argi+1];
+ size_t pos = 0;
+
+ nx_log.log_level(false);
+ nx_log.log_time(false);
+ nx_log.log_unix_time(false);
+ nx_log.log_location(false);
+ nx_log.log_thread_id(false);
+
+ for(pos =0;pos<strlen(format);pos++)
+ {
+ switch(format[pos])
+ {
+ case '0': break;
+ case 't': nx_log.log_time(true); break;
+ case 'u': nx_log.log_time(true); nx_log.log_unix_time(true); break;
+ case 'l': nx_log.log_level(true); break;
+ case 'T': nx_log.log_thread_id(true); break;
+ case 'L': nx_log.log_location(true); break;
+ default : cerr << "Unrecognized format specifier: " << format[pos] << endl; break;
+ }
+ }
+
+ argi++;
+ break;
+ }
+
+
default:
{
PrintUsageInfo(nextArg, 1);
@@ -9113,16 +8759,21 @@ int ParseCommandLineOptions(int argc, const char **argv)
// command line at the connecting side.
//
- if (ParseHostOption(nextArg, connectHost, connectPort) > 0)
- {
- //
- // Assume port is at a proxied display offset.
- //
+ char cHost[DEFAULT_STRING_LENGTH] = { '\0' };
+ long cPort = 0;
- proxyPort = connectPort;
+ if (ParseHostOption(nextArg, cHost, cPort) > 0)
+ {
+ //
+ // Assume port is at a proxied display offset.
+ //
- connectPort += DEFAULT_NX_PROXY_PORT_OFFSET;
- }
+ proxyPort = cPort;
+
+ cPort += DEFAULT_NX_PROXY_PORT_OFFSET;
+ connectSocket.setSpec(cHost, cPort);
+
+ }
else if (ParseEnvironmentOptions(nextArg, 1) < 0)
{
return -1;
@@ -9191,20 +8842,16 @@ int ParseFileOptions(const char *file)
strcpy(fileName, file);
}
- #ifdef TEST
- *logofs << "Loop: Going to read options from file '"
- << fileName << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to read options from file '"
+ << fileName << "'.\n" << std::flush;
FILE *filePtr = fopen(fileName, "r");
if (filePtr == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't open options file '" << fileName
+ nxfatal << "Loop: PANIC! Can't open options file '" << fileName
<< "'. Error is " << EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Can't open options file '" << fileName
<< "'. Error is " << EGET() << " '" << ESTR() << "'.\n";
@@ -9224,11 +8871,9 @@ int ParseFileOptions(const char *file)
if (fgets(options, DEFAULT_DISPLAY_OPTIONS_LENGTH, filePtr) == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't read options from file '" << fileName
+ nxfatal << "Loop: PANIC! Can't read options from file '" << fileName
<< "'. Error is " << EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Can't read options from file '" << fileName
<< "'. Error is " << EGET() << " '" << ESTR() << "'.\n";
@@ -9259,10 +8904,8 @@ int ParseFileOptions(const char *file)
next++;
}
- #ifdef TEST
- *logofs << "Loop: Read options '" << options << "' from file '"
- << fileName << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Read options '" << options << "' from file '"
+ << fileName << "'.\n" << std::flush;
if (ParseEnvironmentOptions(options, 1) < 0)
{
@@ -9283,11 +8926,9 @@ int ParseFileOptions(const char *file)
int ParseRemoteOptions(char *opts)
{
- #ifdef TEST
- *logofs << "Loop: Going to parse the remote options "
- << "string '" << opts << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to parse the remote options "
+ << "string '" << opts << "'.\n"
+ << std::flush;
char *name;
char *value;
@@ -9306,12 +8947,7 @@ int ParseRemoteOptions(char *opts)
int hasDelta = 0;
int hasStream = 0;
int hasData = 0;
- int hasLimit = 0;
- int hasRender = 0;
- int hasTaint = 0;
int hasType = 0;
- int hasStrict = 0;
- int hasShseg = 0;
//
// Get rid of the terminating space.
@@ -9337,11 +8973,9 @@ int ParseRemoteOptions(char *opts)
{
if (WE_PROVIDE_CREDENTIALS)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Ignoring remote option 'cookie' "
- << "with value '" << value << "' when initiating "
- << "connection.\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Ignoring remote option 'cookie' "
+ << "with value '" << value << "' when initiating "
+ << "connection.\n" << std::flush;
cerr << "Warning" << ": Ignoring remote option 'cookie' "
<< "with value '" << value << "' when initiating "
@@ -9349,11 +8983,9 @@ int ParseRemoteOptions(char *opts)
}
else if (strncasecmp(authCookie, value, strlen(authCookie)) != 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Authentication cookie '" << value
+ nxfatal << "Loop: PANIC! Authentication cookie '" << value
<< "' doesn't match '" << authCookie << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Authentication cookie '" << value
<< "' doesn't match '" << authCookie << "'.\n";
@@ -9373,11 +9005,9 @@ int ParseRemoteOptions(char *opts)
{
if (*linkSpeedName != '\0' && strcasecmp(linkSpeedName, value) != 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Overriding option 'link' "
- << "with new value '" << value << "'.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Overriding option 'link' "
+ << "with new value '" << value << "'.\n"
+ << std::flush;
cerr << "Warning" << ": Overriding option 'link' "
<< "with new value '" << value << "'.\n";
@@ -9385,11 +9015,9 @@ int ParseRemoteOptions(char *opts)
if (ParseLinkOption(value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify remote 'link' "
+ nxfatal << "Loop: PANIC! Can't identify remote 'link' "
<< "option in string '" << value << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Can't identify remote 'link' "
<< "option in string '" << value << "'.\n";
@@ -9410,11 +9038,9 @@ int ParseRemoteOptions(char *opts)
{
if (*packMethodName != '\0' && strcasecmp(packMethodName, value) != 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Overriding option 'pack' "
- << "with remote value '" << value << "'.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Overriding option 'pack' "
+ << "with remote value '" << value << "'.\n"
+ << std::flush;
cerr << "Warning" << ": Overriding option 'pack' "
<< "with remote value '" << value << "'.\n";
@@ -9422,11 +9048,9 @@ int ParseRemoteOptions(char *opts)
if (ParsePackOption(value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid pack option '"
+ nxfatal << "Loop: PANIC! Invalid pack option '"
<< value << "' requested by remote.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Invalid pack option '"
<< value << "' requested by remote.\n";
@@ -9454,11 +9078,9 @@ int ParseRemoteOptions(char *opts)
if (ParseCacheOption(value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify remote 'cache' "
+ nxfatal << "Loop: PANIC! Can't identify remote 'cache' "
<< "option in string '" << value << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Can't identify remote 'cache' "
<< "option in string '" << value << "'.\n";
@@ -9485,11 +9107,9 @@ int ParseRemoteOptions(char *opts)
if (ParseImagesOption(value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify remote 'images' "
+ nxfatal << "Loop: PANIC! Can't identify remote 'images' "
<< "option in string '" << value << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Can't identify remote 'images' "
<< "option in string '" << value << "'.\n";
@@ -9511,11 +9131,9 @@ int ParseRemoteOptions(char *opts)
if (*bitrateLimitName != '\0' &&
strcasecmp(bitrateLimitName, value) != 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Overriding option 'limit' "
- << "with new value '" << value << "'.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Overriding option 'limit' "
+ << "with new value '" << value << "'.\n"
+ << std::flush;
cerr << "Warning" << ": Overriding option 'limit' "
<< "with new value '" << value << "'.\n";
@@ -9523,11 +9141,9 @@ int ParseRemoteOptions(char *opts)
if (ParseBitrateOption(value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify 'limit' "
+ nxfatal << "Loop: PANIC! Can't identify 'limit' "
<< "option in string '" << value << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Can't identify 'limit' "
<< "option in string '" << value << "'.\n";
@@ -9536,7 +9152,6 @@ int ParseRemoteOptions(char *opts)
}
}
- hasLimit = 1;
}
else if (strcasecmp(name, "render") == 0)
{
@@ -9549,7 +9164,6 @@ int ParseRemoteOptions(char *opts)
useRender = ValidateArg("remote", name, value);
}
- hasRender = 1;
}
else if (strcasecmp(name, "taint") == 0)
{
@@ -9562,7 +9176,6 @@ int ParseRemoteOptions(char *opts)
useTaint = ValidateArg("remote", name, value);
}
- hasTaint = 1;
}
else if (strcasecmp(name, "type") == 0)
{
@@ -9595,7 +9208,6 @@ int ParseRemoteOptions(char *opts)
useStrict = ValidateArg("remote", name, value);
}
- hasStrict = 1;
}
else if (strcasecmp(name, "shseg") == 0)
{
@@ -9605,11 +9217,9 @@ int ParseRemoteOptions(char *opts)
}
else if (ParseShmemOption(value) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't identify size of shared memory "
+ nxfatal << "Loop: PANIC! Can't identify size of shared memory "
<< "segment in string '" << value << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Can't identify size of shared memory "
<< "segment in string '" << value << "'.\n";
@@ -9617,7 +9227,6 @@ int ParseRemoteOptions(char *opts)
return -1;
}
- hasShseg = 1;
}
else if (strcasecmp(name, "delta") == 0)
{
@@ -9740,19 +9349,15 @@ int ParseRemoteOptions(char *opts)
// versions.
//
- #ifdef DEBUG
- *logofs << "Loop: Ignoring obsolete remote option '"
- << name << "' with value '" << value
- << "'.\n" << logofs_flush;
- #endif
+ nxdbg << "Loop: Ignoring obsolete remote option '"
+ << name << "' with value '" << value
+ << "'.\n" << std::flush;
}
else
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Ignoring unknown remote option '"
- << name << "' with value '" << value << "'.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Ignoring unknown remote option '"
+ << name << "' with value '" << value << "'.\n"
+ << std::flush;
cerr << "Warning" << ": Ignoring unknown remote option '"
<< name << "' with value '" << value << "'.\n";
@@ -9841,10 +9446,8 @@ int ParseRemoteOptions(char *opts)
if (*missing != '\0')
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! The remote peer didn't specify the option '"
- << missing << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! The remote peer didn't specify the option '"
+ << missing << "'.\n" << std::flush;
cerr << "Error" << ": The remote peer didn't specify the option '"
<< missing << "'.\n";
@@ -9862,11 +9465,9 @@ int ParseRemoteOptions(char *opts)
int ParseForwarderOptions(char *opts)
{
- #ifdef TEST
- *logofs << "Loop: Going to parse the forwarder options "
- << "string '" << opts << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to parse the forwarder options "
+ << "string '" << opts << "'.\n"
+ << std::flush;
char *name;
char *value;
@@ -9897,11 +9498,9 @@ int ParseForwarderOptions(char *opts)
{
if (strncasecmp(authCookie, value, strlen(authCookie)) != 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! The NX forwarder cookie '" << value
+ nxfatal << "Loop: PANIC! The NX forwarder cookie '" << value
<< "' doesn't match '" << authCookie << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": The NX forwarder cookie '" << value
<< "' doesn't match '" << authCookie << "'.\n";
@@ -9913,11 +9512,9 @@ int ParseForwarderOptions(char *opts)
}
else
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Ignoring unknown forwarder option '"
- << name << "' with value '" << value << "'.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Ignoring unknown forwarder option '"
+ << name << "' with value '" << value << "'.\n"
+ << std::flush;
cerr << "Warning" << ": Ignoring unknown forwarder option '"
<< name << "' with value '" << value << "'.\n";
@@ -9929,10 +9526,8 @@ int ParseForwarderOptions(char *opts)
if (hasCookie == 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! The NX forwarder didn't provide "
- << "the authentication cookie.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! The NX forwarder didn't provide "
+ << "the authentication cookie.\n" << std::flush;
cerr << "Error" << ": The NX forwarder didn't provide "
<< "the authentication cookie.\n";
@@ -9951,10 +9546,8 @@ int SetCore()
if (getrlimit(RLIMIT_CORE, &rlim))
{
- #ifdef TEST
- *logofs << "Cannot read RLIMIT_CORE. Error is '"
- << ESTR() << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Cannot read RLIMIT_CORE. Error is '"
+ << ESTR() << "'.\n" << std::flush;
return -1;
}
@@ -9965,19 +9558,15 @@ int SetCore()
if (setrlimit(RLIMIT_CORE, &rlim))
{
- #ifdef TEST
- *logofs << "Loop: Cannot read RLIMIT_CORE. Error is '"
- << ESTR() << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Cannot read RLIMIT_CORE. Error is '"
+ << ESTR() << "'.\n" << std::flush;
return -2;
}
}
- #ifdef TEST
- *logofs << "Loop: Set RLIMIT_CORE to "<< rlim.rlim_max
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Set RLIMIT_CORE to "<< rlim.rlim_max
+ << ".\n" << std::flush;
#endif // #ifdef COREDUMPS
@@ -9989,11 +9578,9 @@ char *GetLastCache(char *listBuffer, const char *searchPath)
if (listBuffer == NULL || searchPath == NULL ||
strncmp(listBuffer, "cachelist=", strlen("cachelist=")) != 0)
{
- #ifdef TEST
- *logofs << "Loop: Invalid parameters '" << listBuffer << "' and '"
- << (searchPath != NULL ? searchPath : "")
- << "'. Can't select any cache.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Invalid parameters '" << listBuffer << "' and '"
+ << (searchPath != NULL ? searchPath : "")
+ << "'. Can't select any cache.\n" << std::flush;
return NULL;
}
@@ -10040,10 +9627,8 @@ char *GetLastCache(char *listBuffer, const char *searchPath)
{
if (strncmp(fileName, "none", strlen("none")) == 0)
{
- #ifdef TEST
- *logofs << "Loop: No cache files seem to be available.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: No cache files seem to be available.\n"
+ << std::flush;
delete [] selectedName;
@@ -10052,10 +9637,8 @@ char *GetLastCache(char *listBuffer, const char *searchPath)
else if (strlen(fileName) != MD5_LENGTH * 2 + 2 ||
strncmp(fileName, remotePrefix, 2) != 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Bad cache file name '"
- << fileName << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Bad cache file name '"
+ << fileName << "'.\n" << std::flush;
cerr << "Error" << ": Bad cache file name '"
<< fileName << "'.\n";
@@ -10065,10 +9648,8 @@ char *GetLastCache(char *listBuffer, const char *searchPath)
HandleCleanup();
}
- #ifdef TEST
- *logofs << "Loop: Parsing remote cache name '"
- << fileName << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Parsing remote cache name '"
+ << fileName << "'.\n" << std::flush;
//
// Prefix, received as "S-", becomes
@@ -10083,10 +9664,8 @@ char *GetLastCache(char *listBuffer, const char *searchPath)
if (stat(fullPath, &fileStat) == 0)
{
- #ifdef TEST
- *logofs << "Loop: Found a matching cache '"
- << fullPath << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Found a matching cache '"
+ << std::string(fullPath) << "'.\n" << std::flush;
if (fileStat.st_mtime >= selectedTime)
{
@@ -10095,13 +9674,11 @@ char *GetLastCache(char *listBuffer, const char *searchPath)
selectedTime = fileStat.st_mtime;
}
}
- #ifdef TEST
else
{
- *logofs << "Loop: Can't get stats of file '"
- << fullPath << "'.\n" << logofs_flush;
+ nxinfo << "Loop: Can't get stats of file '"
+ << std::string(fullPath) << "'.\n" << std::flush;
}
- #endif
fileName = strtok(NULL, ",");
}
@@ -10131,19 +9708,15 @@ char *GetTempPath()
if (tempEnv == NULL || *tempEnv == '\0')
{
- #ifdef TEST
- *logofs << "Loop: WARNING! No environment for NX_TEMP.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! No environment for NX_TEMP.\n"
+ << std::flush;
tempEnv = getenv("TEMP");
if (tempEnv == NULL || *tempEnv == '\0')
{
- #ifdef TEST
- *logofs << "Loop: WARNING! No environment for TEMP.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! No environment for TEMP.\n"
+ << std::flush;
tempEnv = "/tmp";
}
@@ -10151,11 +9724,9 @@ char *GetTempPath()
if (strlen(tempEnv) > DEFAULT_STRING_LENGTH - 1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid value for the NX "
+ nxfatal << "Loop: PANIC! Invalid value for the NX "
<< "temporary directory '" << tempEnv
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
cerr << "Error" << ": Invalid value for the NX "
<< "temporary directory '" << tempEnv
@@ -10166,20 +9737,16 @@ char *GetTempPath()
strcpy(tempDir, tempEnv);
- #ifdef TEST
- *logofs << "Loop: Assuming temporary NX directory '"
- << tempDir << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming temporary NX directory '"
+ << tempDir << "'.\n" << std::flush;
}
char *tempPath = new char[strlen(tempDir) + 1];
if (tempPath == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't allocate memory "
- << "for the temp path.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't allocate memory "
+ << "for the temp path.\n" << std::flush;
cerr << "Error" << ": Can't allocate memory "
<< "for the temp path.\n";
@@ -10204,10 +9771,8 @@ char *GetClientPath()
if (clientEnv == NULL || *clientEnv == '\0')
{
- #ifdef TEST
- *logofs << "Loop: WARNING! No environment for NX_CLIENT.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! No environment for NX_CLIENT.\n"
+ << std::flush;
//
// Try to guess the location of the client.
@@ -10230,11 +9795,9 @@ char *GetClientPath()
if (strlen(clientEnv) > DEFAULT_STRING_LENGTH - 1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid value for the NX "
+ nxfatal << "Loop: PANIC! Invalid value for the NX "
<< "client directory '" << clientEnv
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
cerr << "Error" << ": Invalid value for the NX "
<< "client directory '" << clientEnv
@@ -10245,20 +9808,16 @@ char *GetClientPath()
strcpy(clientDir, clientEnv);
- #ifdef TEST
- *logofs << "Loop: Assuming NX client location '"
- << clientDir << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming NX client location '"
+ << clientDir << "'.\n" << std::flush;
}
char *clientPath = new char[strlen(clientDir) + 1];
if (clientPath == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't allocate memory "
- << "for the client path.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't allocate memory "
+ << "for the client path.\n" << std::flush;
cerr << "Error" << ": Can't allocate memory "
<< "for the client path.\n";
@@ -10283,21 +9842,17 @@ char *GetSystemPath()
if (systemEnv == NULL || *systemEnv == '\0')
{
- #ifdef TEST
- *logofs << "Loop: WARNING! No environment for NX_SYSTEM.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! No environment for NX_SYSTEM.\n"
+ << std::flush;
systemEnv = "/usr/NX";
}
if (strlen(systemEnv) > DEFAULT_STRING_LENGTH - 1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid value for the NX "
+ nxfatal << "Loop: PANIC! Invalid value for the NX "
<< "system directory '" << systemEnv
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
cerr << "Error" << ": Invalid value for the NX "
<< "system directory '" << systemEnv
@@ -10308,20 +9863,16 @@ char *GetSystemPath()
strcpy(systemDir, systemEnv);
- #ifdef TEST
- *logofs << "Loop: Assuming system NX directory '"
- << systemDir << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming system NX directory '"
+ << systemDir << "'.\n" << std::flush;
}
char *systemPath = new char[strlen(systemDir) + 1];
if (systemPath == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't allocate memory "
- << "for the system path.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't allocate memory "
+ << "for the system path.\n" << std::flush;
cerr << "Error" << ": Can't allocate memory "
<< "for the system path.\n";
@@ -10346,19 +9897,15 @@ char *GetHomePath()
if (homeEnv == NULL || *homeEnv == '\0')
{
- #ifdef TEST
- *logofs << "Loop: WARNING! No environment for NX_HOME.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! No environment for NX_HOME.\n"
+ << std::flush;
homeEnv = getenv("HOME");
if (homeEnv == NULL || *homeEnv == '\0')
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! No environment for HOME.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! No environment for HOME.\n"
+ << std::flush;
cerr << "Error" << ": No environment for HOME.\n";
@@ -10368,11 +9915,9 @@ char *GetHomePath()
if (strlen(homeEnv) > DEFAULT_STRING_LENGTH - 1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid value for the NX "
+ nxfatal << "Loop: PANIC! Invalid value for the NX "
<< "home directory '" << homeEnv
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
cerr << "Error" << ": Invalid value for the NX "
<< "home directory '" << homeEnv
@@ -10383,20 +9928,16 @@ char *GetHomePath()
strcpy(homeDir, homeEnv);
- #ifdef TEST
- *logofs << "Loop: Assuming NX user's home directory '"
- << homeDir << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming NX user's home directory '"
+ << homeDir << "'.\n" << std::flush;
}
char *homePath = new char[strlen(homeDir) + 1];
if (homePath == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't allocate memory "
- << "for the home path.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't allocate memory "
+ << "for the home path.\n" << std::flush;
cerr << "Error" << ": Can't allocate memory "
<< "for the home path.\n";
@@ -10421,10 +9962,8 @@ char *GetRootPath()
if (rootEnv == NULL || *rootEnv == '\0')
{
- #ifdef TEST
- *logofs << "Loop: WARNING! No environment for NX_ROOT.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! No environment for NX_ROOT.\n"
+ << std::flush;
//
// We will determine the root NX directory
@@ -10437,11 +9976,9 @@ char *GetRootPath()
if (strlen(homeEnv) > DEFAULT_STRING_LENGTH -
strlen("/.nx") - 1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid value for the NX "
+ nxfatal << "Loop: PANIC! Invalid value for the NX "
<< "home directory '" << homeEnv
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
cerr << "Error" << ": Invalid value for the NX "
<< "home directory '" << homeEnv
@@ -10450,11 +9987,9 @@ char *GetRootPath()
HandleCleanup();
}
- #ifdef TEST
- *logofs << "Loop: Assuming NX root directory in "
- << "the user's home '" << homeEnv
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming NX root directory in "
+ << "the user's home '" << homeEnv
+ << "'.\n" << std::flush;
strcpy(rootDir, homeEnv);
strcat(rootDir, "/.nx");
@@ -10471,11 +10006,9 @@ char *GetRootPath()
{
if (mkdir(rootDir, 0700) < 0 && (EGET() != EEXIST))
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't create directory '"
+ nxfatal << "Loop: PANIC! Can't create directory '"
<< rootDir << ". Error is " << EGET() << " '"
- << ESTR() << "'.\n" << logofs_flush;
- #endif
+ << ESTR() << "'.\n" << std::flush;
cerr << "Error" << ": Can't create directory '"
<< rootDir << ". Error is " << EGET() << " '"
@@ -10489,11 +10022,9 @@ char *GetRootPath()
{
if (strlen(rootEnv) > DEFAULT_STRING_LENGTH - 1)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid value for the NX "
+ nxfatal << "Loop: PANIC! Invalid value for the NX "
<< "root directory '" << rootEnv
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
cerr << "Error" << ": Invalid value for the NX "
<< "root directory '" << rootEnv
@@ -10504,21 +10035,17 @@ char *GetRootPath()
strcpy(rootDir, rootEnv);
}
-
- #ifdef TEST
- *logofs << "Loop: Assuming NX root directory '"
- << rootDir << "'.\n" << logofs_flush;
- #endif
+
+ nxinfo << "Loop: Assuming NX root directory '"
+ << rootDir << "'.\n" << std::flush;
}
char *rootPath = new char[strlen(rootDir) + 1];
if (rootPath == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't allocate memory "
- << "for the root path.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't allocate memory "
+ << "for the root path.\n" << std::flush;
cerr << "Error" << ": Can't allocate memory "
<< "for the root path.\n";
@@ -10570,11 +10097,9 @@ char *GetCachePath()
{
if (mkdir(cachePath, 0700) < 0 && (EGET() != EEXIST))
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't create directory '" << cachePath
+ nxfatal << "Loop: PANIC! Can't create directory '" << cachePath
<< ". Error is " << EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Can't create directory '" << cachePath
<< ". Error is " << EGET() << " '" << ESTR() << "'.\n";
@@ -10611,11 +10136,9 @@ char *GetImagesPath()
{
if (mkdir(imagesPath, 0700) < 0 && (EGET() != EEXIST))
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't create directory '" << imagesPath
+ nxfatal << "Loop: PANIC! Can't create directory '" << imagesPath
<< ". Error is " << EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Can't create directory '" << imagesPath
<< ". Error is " << EGET() << " '" << ESTR() << "'.\n";
@@ -10650,11 +10173,9 @@ char *GetImagesPath()
{
if (mkdir(digitPath, 0700) < 0 && (EGET() != EEXIST))
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't create directory '" << digitPath
+ nxfatal << "Loop: PANIC! Can't create directory '" << digitPath
<< ". Error is " << EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Can't create directory '" << digitPath
<< ". Error is " << EGET() << " '" << ESTR() << "'.\n";
@@ -10708,11 +10229,9 @@ char *GetSessionPath()
{
if (mkdir(sessionDir, 0700) < 0 && (EGET() != EEXIST))
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't create directory '" << sessionDir
+ nxfatal << "Loop: PANIC! Can't create directory '" << sessionDir
<< ". Error is " << EGET() << " '" << ESTR() << "'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Can't create directory '" << sessionDir
<< ". Error is " << EGET() << " '" << ESTR() << "'.\n";
@@ -10723,10 +10242,8 @@ char *GetSessionPath()
}
}
- #ifdef TEST
- *logofs << "Loop: Root of NX session is '" << sessionDir
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Root of NX session is '" << sessionDir
+ << "'.\n" << std::flush;
delete [] rootPath;
}
@@ -10796,16 +10313,12 @@ int ParseLinkOption(const char *opt)
int ParsePackOption(const char *opt)
{
- #ifdef DEBUG
- *logofs << "Loop: Pack method is " << packMethod
- << " quality is " << packQuality << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Pack method is " << packMethod
+ << " quality is " << packQuality << ".\n"
+ << std::flush;
- #ifdef DEBUG
- *logofs << "Loop: Parsing pack method '" << opt
- << "'.\n" << logofs_flush;
- #endif
+ nxdbg << "Loop: Parsing pack method '" << opt
+ << "'.\n" << std::flush;
if (strcasecmp(opt, "0") == 0 ||
strcasecmp(opt, "none") == 0 ||
@@ -10986,17 +10499,15 @@ int ParsePackOption(const char *opt)
packMethod == PACK_LOSSLESS ||
packMethod == PACK_ADAPTIVE)
{
- const char *dash = rindex(opt, '-');
+ const char *dash = strrchr(opt, '-');
if (dash != NULL && strlen(dash) == 2 &&
*(dash + 1) >= '0' && *(dash + 1) <= '9')
{
packQuality = atoi(dash + 1);
- #ifdef DEBUG
- *logofs << "Loop: Using pack quality '"
- << packQuality << "'.\n" << logofs_flush;
- #endif
+ nxdbg << "Loop: Using pack quality '"
+ << packQuality << "'.\n" << std::flush;
}
}
else
@@ -11299,18 +10810,14 @@ int SetLogs()
{
strcpy(statsFileName, "stats");
- #ifdef TEST
- *logofs << "Loop: Assuming default statistics file '"
- << statsFileName << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming default statistics file '"
+ << statsFileName << "'.\n" << std::flush;
}
- #ifdef TEST
else
{
- *logofs << "Loop: Name selected for statistics is '"
- << statsFileName << "'.\n" << logofs_flush;
+ nxinfo << "Loop: Name selected for statistics is '"
+ << statsFileName << "'.\n" << std::flush;
}
- #endif
if (OpenLogFile(statsFileName, statofs) < 0)
{
@@ -11323,18 +10830,14 @@ int SetLogs()
{
strcpy(errorsFileName, "errors");
- #ifdef TEST
- *logofs << "Loop: Assuming default log file name '"
- << errorsFileName << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming default log file name '"
+ << errorsFileName << "'.\n" << std::flush;
}
- #ifdef TEST
else
{
- *logofs << "Loop: Name selected for log file is '"
- << errorsFileName << "'.\n" << logofs_flush;
+ nxinfo << "Loop: Name selected for log file is '"
+ << errorsFileName << "'.\n" << std::flush;
}
- #endif
//
// Share the bebug output with the nxssh binder
@@ -11372,27 +10875,21 @@ int SetLogs()
if (*sessionFileName != '\0')
{
- #ifdef TEST
- *logofs << "Loop: Name selected for session file is '"
- << sessionFileName << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Name selected for session file is '"
+ << sessionFileName << "'.\n" << std::flush;
if (errofs != NULL)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Unexpected value for stream errofs.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Unexpected value for stream errofs.\n"
+ << std::flush;
cerr << "Warning" << ": Unexpected value for stream errofs.\n";
}
if (errsbuf != NULL)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Unexpected value for buffer errsbuf.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Unexpected value for buffer errsbuf.\n"
+ << std::flush;
cerr << "Warning" << ": Unexpected value for buffer errsbuf.\n";
}
@@ -11438,243 +10935,90 @@ int SetPorts()
// ing, causing a loop.
//
- if (cupsPort <= 0)
- {
- #ifdef TEST
- *logofs << "Loop: Disabling cups connections.\n"
- << logofs_flush;
- #endif
-
- cupsPort = 0;
-
- useCupsSocket = 0;
- }
- else
- {
- if (control -> ProxyMode == proxy_client)
- {
- if (cupsPort == 1)
- {
- cupsPort = DEFAULT_NX_CUPS_PORT_OFFSET + proxyPort;
- }
-
- useCupsSocket = 1;
- }
- else
- {
- if (cupsPort == 1)
- {
- //
- // Use the well-known 631/tcp port of the
- // Internet Printing Protocol.
- //
-
- cupsPort = 631;
- }
-
- useCupsSocket = 0;
- }
-
- #ifdef TEST
- *logofs << "Loop: Using cups port '" << cupsPort
- << "'.\n" << logofs_flush;
- #endif
+ if (control -> ProxyMode == proxy_client) {
+ // ChannelEndPoint::enabled() implements the logic described above,
+ // and takes the default port into consideration. If cups=1, and
+ // there is a default port, then enabled() will return true.
+ //
+ // Therefore, we must set the default port before calling this
+ // function.
+ cupsPort.setDefaultTCPPort(DEFAULT_NX_CUPS_PORT_OFFSET + proxyPort);
+ useCupsSocket = cupsPort.enabled();
+ } else {
+ cupsPort.setDefaultTCPPort(631);
}
- if (auxPort <= 0)
- {
- #ifdef TEST
- *logofs << "Loop: Disabling auxiliary X11 connections.\n"
- << logofs_flush;
- #endif
- auxPort = 0;
- useAuxSocket = 0;
- }
- else
- {
- if (control -> ProxyMode == proxy_client)
- {
- if (auxPort == 1)
- {
- auxPort = DEFAULT_NX_AUX_PORT_OFFSET + proxyPort;
- }
+ nxinfo << "Loop: cups port: " << cupsPort << "\n"
+ << std::flush;
- useAuxSocket = 1;
- }
- else
- {
- //
- // Auxiliary X connections are always forwarded
- // to the display where the session is running.
- // The only value accepted is 1.
- //
-
- if (auxPort != 1)
- {
- #ifdef WARNING
- *logofs << "Loop: WARNING! Overriding auxiliary X11 "
- << "port with new value '" << 1 << "'.\n"
- << logofs_flush;
- #endif
+ if (control -> ProxyMode == proxy_client) {
+ auxPort.setDefaultTCPPort(DEFAULT_NX_AUX_PORT_OFFSET + proxyPort);
+ useAuxSocket = auxPort.enabled();
+ } else {
+ auxPort.setDefaultTCPPort(1);
- cerr << "Warning" << ": Overriding auxiliary X11 "
- << "port with new value '" << 1 << "'.\n";
+ if ( auxPort.getTCPPort() != 1 ) {
+ nxwarn << "Loop: WARNING! Overriding auxiliary X11 "
+ << "port with new value '" << 1 << "'.\n"
+ << std::flush;
- auxPort = 1;
- }
+ cerr << "Warning" << ": Overriding auxiliary X11 "
+ << "port with new value '" << 1 << "'.\n";
- useAuxSocket = 0;
+ auxPort.setSpec("1");
}
-
- #ifdef TEST
- *logofs << "Loop: Using auxiliary X11 port '" << auxPort
- << "'.\n" << logofs_flush;
- #endif
}
- if (smbPort <= 0)
- {
- #ifdef TEST
- *logofs << "Loop: Disabling SMB connections.\n"
- << logofs_flush;
- #endif
-
- smbPort = 0;
+ nxinfo << "Loop: aux port: " << auxPort << "\n"
+ << std::flush;
- useSmbSocket = 0;
+ if (control -> ProxyMode == proxy_client) {
+ smbPort.setDefaultTCPPort(DEFAULT_NX_SMB_PORT_OFFSET + proxyPort);
+ useSmbSocket = smbPort.enabled();
+ } else {
+ smbPort.setDefaultTCPPort(139);
}
- else
- {
- if (control -> ProxyMode == proxy_client)
- {
- if (smbPort == 1)
- {
- smbPort = DEFAULT_NX_SMB_PORT_OFFSET + proxyPort;
- }
- useSmbSocket = 1;
- }
- else
- {
- if (smbPort == 1)
- {
- //
- // Assume the 139/tcp port used for SMB
- // over NetBIOS over TCP.
- //
-
- smbPort = 139;
- }
-
- useSmbSocket = 0;
- }
-
- #ifdef TEST
- *logofs << "Loop: Using SMB port '" << smbPort
- << "'.\n" << logofs_flush;
- #endif
- }
-
- if (mediaPort <= 0)
- {
- #ifdef TEST
- *logofs << "Loop: Disabling multimedia connections.\n"
- << logofs_flush;
- #endif
- mediaPort = 0;
+ nxinfo << "Loop: smb port: " << smbPort << "\n"
+ << std::flush;
- useMediaSocket = 0;
- }
- else
- {
- if (control -> ProxyMode == proxy_client)
- {
- if (mediaPort == 1)
- {
- mediaPort = DEFAULT_NX_MEDIA_PORT_OFFSET + proxyPort;
- }
-
- useMediaSocket = 1;
- }
- else
- {
- if (mediaPort == 1)
- {
- //
- // We don't have a well-known port to
- // be used for media connections.
- //
+ if ( mediaPort.configured() ) {
+ if (control -> ProxyMode == proxy_client) {
+ mediaPort.setDefaultTCPPort(DEFAULT_NX_MEDIA_PORT_OFFSET + proxyPort);
+ useMediaSocket = mediaPort.enabled();
+ } else {
- #ifdef PANIC
- *logofs << "Loop: PANIC! No port specified for multimedia connections.\n"
- << logofs_flush;
- #endif
+ if ( mediaPort.getTCPPort() < 0 ) {
+ nxfatal << "Loop: PANIC! No port specified for multimedia connections.\n"
+ << std::flush;
cerr << "Error" << ": No port specified for multimedia connections.\n";
HandleCleanup();
}
-
- useMediaSocket = 0;
}
-
- #ifdef TEST
- *logofs << "Loop: Using multimedia port '" << mediaPort
- << "'.\n" << logofs_flush;
- #endif
}
- if (httpPort <= 0)
- {
- #ifdef TEST
- *logofs << "Loop: Disabling HTTP connections.\n"
- << logofs_flush;
- #endif
-
- httpPort = 0;
+ nxinfo << "Loop: Using multimedia port '" << mediaPort
+ << "'.\n" << std::flush;
- useHttpSocket = 0;
+ if (control -> ProxyMode == proxy_client) {
+ httpPort.setDefaultTCPPort(DEFAULT_NX_HTTP_PORT_OFFSET + proxyPort);
+ useHttpSocket = httpPort.enabled();
+ } else {
+ httpPort.setDefaultTCPPort(80);
}
- else
- {
- if (control -> ProxyMode == proxy_client)
- {
- if (httpPort == 1)
- {
- httpPort = DEFAULT_NX_HTTP_PORT_OFFSET + proxyPort;
- }
-
- useHttpSocket = 1;
- }
- else
- {
- if (httpPort == 1)
- {
- //
- // Use the well-known 80/tcp port.
- //
-
- httpPort = 80;
- }
- useHttpSocket = 0;
- }
-
- #ifdef TEST
- *logofs << "Loop: Using HTTP port '" << httpPort
- << "'.\n" << logofs_flush;
- #endif
- }
+ nxinfo << "Loop: Using HTTP port '" << httpPort
+ << "'.\n" << std::flush;
if (ParseFontPath(fontPort) <= 0)
{
- #ifdef TEST
- *logofs << "Loop: Disabling font server connections.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Disabling font server connections.\n"
+ << std::flush;
*fontPort = '\0';
@@ -11698,49 +11042,19 @@ int SetPorts()
useFontSocket = 0;
}
- #ifdef TEST
- *logofs << "Loop: Using font server port '" << fontPort
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Using font server port '" << fontPort
+ << "'.\n" << std::flush;
}
- if (slavePort <= 0)
- {
- #ifdef TEST
- *logofs << "Loop: Disabling slave connections.\n"
- << logofs_flush;
- #endif
-
- slavePort = 0;
-
- useSlaveSocket = 0;
+ if (control -> ProxyMode == proxy_client) {
+ slavePort.setDefaultTCPPort(DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET + proxyPort);
+ useSlaveSocket = slavePort.enabled();
+ } else {
+ slavePort.setDefaultTCPPort(DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET + proxyPort);
}
- else
- {
- //
- // File transfer connections can
- // be originated by both sides.
- //
- if (slavePort == 1)
- {
- if (control -> ProxyMode == proxy_client)
- {
- slavePort = DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET + proxyPort;
- }
- else
- {
- slavePort = DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET + proxyPort;
- }
- }
-
- useSlaveSocket = 1;
-
- #ifdef TEST
- *logofs << "Loop: Using slave port '" << slavePort
- << "'.\n" << logofs_flush;
- #endif
- }
+ nxinfo << "Loop: Using slave port '" << slavePort
+ << "'.\n" << std::flush;
return 1;
}
@@ -11798,10 +11112,8 @@ int SetDescriptors()
if (limit == 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Cannot determine number of available "
- << "file descriptors.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Cannot determine number of available "
+ << "file descriptors.\n" << std::flush;
cerr << "Error" << ": Cannot determine number of available "
<< "file descriptors.\n";
@@ -11821,20 +11133,16 @@ int SetCaches()
{
if ((control -> PersistentCachePath = GetCachePath()) == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Error getting or creating the cache path.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Error getting or creating the cache path.\n"
+ << std::flush;
cerr << "Error" << ": Error getting or creating the cache path.\n";
HandleCleanup();
}
- #ifdef TEST
- *logofs << "Loop: Path of cache files is '" << control -> PersistentCachePath
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Path of cache files is '" << control -> PersistentCachePath
+ << "'.\n" << std::flush;
return 1;
}
@@ -11950,15 +11258,16 @@ int SetSession()
// to the agent.
//
- if (*sessionType != '\0' &&
- (control -> isProtoStep8() == 1 ||
- strncmp(sessionType, "unix-", strlen("unix-")) != 0))
+ //
+ // Since ProtoStep8 (#issue 108) and also
+ // with older "unix-" sessions
+ //
+
+ if (*sessionType != '\0')
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Unrecognized session type '"
- << sessionType << "'. Assuming agent session.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Unrecognized session type '"
+ << sessionType << "'. Assuming agent session.\n"
+ << std::flush;
cerr << "Warning" << ": Unrecognized session type '"
<< sessionType << "'. Assuming agent session.\n";
@@ -11967,12 +11276,10 @@ int SetSession()
control -> SessionMode = session_agent;
}
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Assuming session type '"
- << DumpSession(control -> SessionMode) << "' with "
- << "string '" << sessionType << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming session type '"
+ << DumpSession(control -> SessionMode) << "' with "
+ << "string '" << sessionType << "'.\n"
+ << std::flush;
//
// By default the policy is immediate. Agents
@@ -11992,21 +11299,17 @@ int SetSession()
control -> FlushPolicy = policy_immediate;
}
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: WARNING! Forcing flush policy to '"
- << DumpPolicy(control -> FlushPolicy)
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! Forcing flush policy to '"
+ << DumpPolicy(control -> FlushPolicy)
+ << ".\n" << std::flush;
}
else
{
control -> FlushPolicy = policy_immediate;
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Setting initial flush policy to '"
- << DumpPolicy(control -> FlushPolicy)
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting initial flush policy to '"
+ << DumpPolicy(control -> FlushPolicy)
+ << "'.\n" << std::flush;
}
//
@@ -12029,19 +11332,15 @@ int SetSession()
if (control -> LinkEncrypted == 1)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Proxy running as part of an "
- << "encrypting client.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Proxy running as part of an "
+ << "encrypting client.\n"
+ << std::flush;
}
else
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Assuming proxy running as a "
- << "standalone program.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming proxy running as a "
+ << "standalone program.\n"
+ << std::flush;
}
//
@@ -12063,10 +11362,8 @@ int SetSession()
if (stat(fileName, &fileStat) == 0)
{
- #ifdef TEST
- *logofs << "Loop: Enabling respawn of client at session shutdown.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Enabling respawn of client at session shutdown.\n"
+ << std::flush;
control -> EnableRestartOnShutdown = 1;
}
@@ -12120,22 +11417,18 @@ int SetStorage()
control -> ClientTotalStorageSize;
}
- #ifdef DEBUG
- *logofs << "Loop: Storage size limit is "
- << control -> ClientTotalStorageSize
- << " at client and "
- << control -> ServerTotalStorageSize
- << " at server.\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Storage size limit is "
+ << control -> ClientTotalStorageSize
+ << " at client and "
+ << control -> ServerTotalStorageSize
+ << " at server.\n"
+ << std::flush;
- #ifdef DEBUG
- *logofs << "Loop: Storage local limit set to "
- << control -> LocalTotalStorageSize
- << " remote limit set to "
- << control -> RemoteTotalStorageSize
- << ".\n" << logofs_flush;
- #endif
+ nxdbg << "Loop: Storage local limit set to "
+ << control -> LocalTotalStorageSize
+ << " remote limit set to "
+ << control -> RemoteTotalStorageSize
+ << ".\n" << std::flush;
//
// Never reserve for split store more than
@@ -12145,11 +11438,9 @@ int SetStorage()
if (size > 0 && control ->
SplitTotalStorageSize > size / 2)
{
- #ifdef TEST
- *logofs << "Loop: Reducing size of split store to "
- << size / 2 << " bytes.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Reducing size of split store to "
+ << size / 2 << " bytes.\n"
+ << std::flush;
control -> SplitTotalStorageSize = size / 2;
}
@@ -12162,11 +11453,9 @@ int SetStorage()
if (control -> HideRender == 1)
{
- #ifdef TEST
- *logofs << "Loop: Not loading render extension "
- << "from persistent cache.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Not loading render extension "
+ << "from persistent cache.\n"
+ << std::flush;
control -> PersistentCacheLoadRender = 0;
}
@@ -12235,22 +11524,22 @@ int SetShmem()
{
control -> ShmemServer = 1;
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Set initial shared memory size "
- << "to " << control -> ShmemServerSize
- << " bytes.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Set initial shared memory size "
+ << "to " << control -> ShmemServerSize
+ << " bytes.\n" << std::flush;
}
else
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Disabled use of the shared memory "
- << "extension.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Disabled use of the shared memory "
+ << "extension.\n" << std::flush;
control -> ShmemServer = 0;
}
+ // For android, no shared memory available
+ control -> ShmemServer = 0;
+ control -> ShmemClientSize = 0;
+
return 1;
}
@@ -12261,11 +11550,9 @@ int SetShmem()
int SetPack()
{
- #ifdef TEST
- *logofs << "Loop: Setting pack with initial method "
- << packMethod << " and quality " << packQuality
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting pack with initial method "
+ << packMethod << " and quality " << packQuality
+ << ".\n" << std::flush;
//
// Check if this is a proxy session and, in
@@ -12276,10 +11563,8 @@ int SetPack()
if (control -> SessionMode == session_proxy)
{
- #ifdef TEST
- *logofs << "Loop: WARNING! Disabling pack with proxy session.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! Disabling pack with proxy session.\n"
+ << std::flush;
packMethod = PACK_NONE;
}
@@ -12300,11 +11585,9 @@ int SetPack()
{
control -> PersistentCacheLoadPacked = 0;
- #ifdef TEST
- *logofs << "Loop: Not loading packed images "
- << "from persistent cache.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Not loading packed images "
+ << "from persistent cache.\n"
+ << std::flush;
}
return 1;
@@ -12324,11 +11607,9 @@ int SetImages()
if (control -> SessionMode == session_proxy)
{
- #ifdef TEST
- *logofs << "Loop: Disabling image cache with "
- << "session '" << DumpSession(control ->
- SessionMode) << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Disabling image cache with "
+ << "session '" << DumpSession(control ->
+ SessionMode) << "'.\n" << std::flush;
sprintf(imagesSizeName, "0");
@@ -12358,28 +11639,22 @@ int SetImages()
{
if ((control -> ImageCachePath = GetImagesPath()) == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Error getting or creating image cache path.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Error getting or creating image cache path.\n"
+ << std::flush;
cerr << "Error" << ": Error getting or creating image cache path.\n";
HandleCleanup();
}
- #ifdef TEST
- *logofs << "Loop: Path of image cache files is '" << control -> ImageCachePath
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Path of image cache files is '" << control -> ImageCachePath
+ << "'.\n" << std::flush;
}
}
else
{
- #ifdef TEST
- *logofs << "Loop: Disabling the persistent image cache.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Disabling the persistent image cache.\n"
+ << std::flush;
control -> ImageCacheEnableLoad = 0;
control -> ImageCacheEnableSave = 0;
@@ -12419,11 +11694,9 @@ int SetVersion()
minor = control -> CompatVersionMinor;
patch = control -> CompatVersionPatch;
- #ifdef TEST
- *logofs << "Loop: Using compatibility version '"
- << major << "." << minor << "." << patch
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Using compatibility version '"
+ << major << "." << minor << "." << patch
+ << "'.\n" << std::flush;
}
else if (control -> LocalVersionMajor >
control -> RemoteVersionMajor)
@@ -12438,11 +11711,9 @@ int SetVersion()
minor = control -> RemoteVersionMinor;
patch = control -> RemoteVersionPatch;
- #ifdef TEST
- *logofs << "Loop: Using remote version '"
- << major << "." << minor << "." << patch
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Using remote version '"
+ << major << "." << minor << "." << patch
+ << "'.\n" << std::flush;
}
else
{
@@ -12460,11 +11731,9 @@ int SetVersion()
minor = control -> RemoteVersionMinor;
patch = control -> RemoteVersionPatch;
- #ifdef TEST
- *logofs << "Loop: Using remote version '"
- << major << "." << minor << "." << patch
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Using remote version '"
+ << major << "." << minor << "." << patch
+ << "'.\n" << std::flush;
}
else
{
@@ -12472,46 +11741,25 @@ int SetVersion()
minor = control -> LocalVersionMinor;
patch = control -> LocalVersionPatch;
- #ifdef TEST
- *logofs << "Loop: Using local version '"
- << major << "." << minor << "." << patch
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Using local version '"
+ << major << "." << minor << "." << patch
+ << "'.\n" << std::flush;
}
}
//
- // Handle the 1.5.0 versions. The protocol
- // step 6 is the minimum supported version.
+ // Handle versions from 3.5.0. The protocol
+ // step 10 is the minimum supported version.
//
int step = 0;
- if (major == 1)
+ if (major == 3)
{
- if (minor == 5)
- {
- step = 6;
- }
- }
- else if (major == 2)
- {
- step = 7;
- }
- else if (major == 3)
- {
- if (minor >= 2)
+ if (minor >= 5)
{
step = 10;
}
- else if (minor > 0 || patch > 0)
- {
- step = 9;
- }
- else
- {
- step = 8;
- }
}
else if (major > 3)
{
@@ -12520,13 +11768,19 @@ int SetVersion()
if (step == 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Incompatible remote version "
+ nxfatal << "Loop: PANIC! Unable to set the protocol step value from "
+ << "the negotiated protocol version " << major << "." << minor
+ << "." << patch << ".\n" << std::flush;
+
+ cerr << "Error" << ": Unable to set the protocol step value from "
+ << "the negotiated protocol version " << major << "." << minor
+ << "." << patch << ".\n";
+
+ nxfatal << "Loop: PANIC! Incompatible remote version "
<< control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor
<< "." << control -> RemoteVersionPatch << " with local version "
<< control -> LocalVersionMajor << "." << control -> LocalVersionMinor
- << "." << control -> LocalVersionPatch << ".\n" << logofs_flush;
- #endif
+ << "." << control -> LocalVersionPatch << ".\n" << std::flush;
cerr << "Error" << ": Incompatible remote version "
<< control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor
@@ -12537,10 +11791,8 @@ int SetVersion()
return -1;
}
- #ifdef TEST
- *logofs << "Loop: Using NX protocol step "
- << step << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Using NX protocol step "
+ << step << ".\n" << std::flush;
control -> setProtoStep(step);
@@ -12556,13 +11808,11 @@ int SetVersion()
if (local != remote)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Connected to remote version "
- << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor
- << "." << control -> RemoteVersionPatch << " with local version "
- << control -> LocalVersionMajor << "." << control -> LocalVersionMinor
- << "." << control -> LocalVersionPatch << ".\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Connected to remote version "
+ << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor
+ << "." << control -> RemoteVersionPatch << " with local version "
+ << control -> LocalVersionMajor << "." << control -> LocalVersionMinor
+ << "." << control -> LocalVersionPatch << ".\n" << std::flush;
cerr << "Warning" << ": Connected to remote version "
<< control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor
@@ -12573,7 +11823,7 @@ int SetVersion()
if (local < remote)
{
- cerr << "Warning" << ": Consider checking http://www.nomachine.com/ for updates.\n";
+ nxerr << "Warning" << ": Consider checking https://github.com/ArcticaProject/nx-libs/releases for updates.\n";
}
//
@@ -12584,97 +11834,19 @@ int SetVersion()
if (control -> ProxyMode == proxy_client)
{
- if (control -> isProtoStep8() == 0)
- {
- if (strncmp(sessionType, "shadow", strlen("shadow")) == 0 ||
- strncmp(sessionType, "application", strlen("application")) == 0 ||
- strncmp(sessionType, "console", strlen("console")) == 0 ||
- strncmp(sessionType, "default", strlen("default")) == 0 ||
- strncmp(sessionType, "gnome", strlen("gnome")) == 0 ||
- strncmp(sessionType, "kde", strlen("kde")) == 0 ||
- strncmp(sessionType, "cde", strlen("cde")) == 0 ||
- strncmp(sessionType, "xdm", strlen("xdm")) == 0)
-
- {
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: WARNING! Prepending 'unix-' to the "
- << "name of the session.\n" << logofs_flush;
- #endif
-
- char buffer[DEFAULT_STRING_LENGTH];
-
- snprintf(buffer, DEFAULT_STRING_LENGTH - 1, "unix-%s", sessionType);
-
- strcpy(sessionType, buffer);
- }
- }
-
//
- // Check if the remote is able to handle
- // the selected pack method.
+ // Since ProtoStep8 (#issue 108)
//
-
- if (control -> isProtoStep8() == 0)
- {
- if (packMethod == PACK_ADAPTIVE || packMethod == PACK_LOSSY)
- {
- #ifdef TEST
- *logofs << "Loop: WARNING! Assuming a lossy encoding with "
- << "an old proxy version.\n" << logofs_flush;
- #endif
-
- packMethod = PACK_JPEG_16M_COLORS;
- }
- else if (packMethod == PACK_LOSSLESS)
- {
- #ifdef TEST
- *logofs << "Loop: WARNING! Assuming a lossless encoding with "
- << "an old proxy version.\n" << logofs_flush;
- #endif
-
- if (control -> isProtoStep7() == 1)
- {
- packMethod = PACK_RLE_16M_COLORS;
- }
- else
- {
- packMethod = PACK_PNG_16M_COLORS;
- }
- }
- }
-
- //
- // If the remote doesn't support the
- // selected method use something that
- // is compatible.
+ // Now it's assumed that the remote is
+ // able to handle the selected pack
+ // method
//
- if ((packMethod == PACK_RGB_16M_COLORS ||
- packMethod == PACK_RLE_16M_COLORS ||
- packMethod == PACK_BITMAP_16M_COLORS) &&
- control -> isProtoStep7() == 0)
- {
- #ifdef TEST
- *logofs << "Loop: WARNING! Setting the pack method to '"
- << PACK_PNG_16M_COLORS << "' with '" << packMethod
- << "' unsupported.\n" << logofs_flush;
- #endif
-
- packMethod = PACK_PNG_16M_COLORS;
- packQuality = 9;
- }
- else if (packMethod == PACK_BITMAP_16M_COLORS &&
- control -> isProtoStep8() == 0)
- {
- #ifdef TEST
- *logofs << "Loop: WARNING! Setting the pack method to '"
- << PACK_RLE_16M_COLORS << "' with '" << packMethod
- << "' unsupported.\n" << logofs_flush;
- #endif
-
- packMethod = PACK_RLE_16M_COLORS;
- packQuality = 9;
- }
+ nxinfo << __FILE__ << " : " << __LINE__ << " - "
+ << "step = " << control -> getProtoStep()
+ << " packMethod = " << packMethod
+ << " packQuality = " << packQuality
+ << ".\n" << std::flush;
//
// Update the pack method name.
@@ -12685,29 +11857,30 @@ int SetVersion()
//
// At the moment the image cache is not used by the
- // agent but we need to take care of the compatibi-
- // lity with old versions. Proxy versions older than
- // the 3.0.0 assume that it is enabled and will send
- // specific bits as part of the encoding. Conversely,
- // it is advisable to disable the cache right now.
- // By not enabling the image cache, the house-keep-
- // ing process will only take care of cleaning up
- // the "cache-" directories.
- //
-
- if (control -> isProtoStep8() == 1)
- {
- #ifdef TEST
- *logofs << "Loop: Disabling image cache with protocol "
- << "step '" << control -> getProtoStep()
- << "'.\n" << logofs_flush;
- #endif
+ // agent. Proxy versions older than 3.0.0 assumed
+ // that it was enabled and sent specific bits as part
+ // of the encoding. Conversely, it is advisable to
+ // disable the cache right now. By not enabling the
+ // the image cache, the house-keeping process will
+ // only take care of cleaning up the "cache-" direc-
+ // tories.
+ //
- sprintf(imagesSizeName, "0");
+ //
+ // Considering that compatibility with older versions
+ // has been set to cover as far as 3.5.0, the cache can
+ // be disabled at this point without any concern
+ //
- control -> ImageCacheEnableLoad = 0;
- control -> ImageCacheEnableSave = 0;
- }
+ // Since ProtoStep8 (#issue 108)
+ nxinfo << "Loop: Disabling image cache with protocol "
+ << "step '" << control -> getProtoStep()
+ << "'.\n" << std::flush;
+
+ sprintf(imagesSizeName, "0");
+
+ control -> ImageCacheEnableLoad = 0;
+ control -> ImageCacheEnableSave = 0;
return 1;
}
@@ -12720,20 +11893,16 @@ int SetVersion()
int SetLink()
{
- #ifdef TEST
- *logofs << "Loop: Setting link with initial value "
- << linkSpeedName << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting link with initial value "
+ << linkSpeedName << ".\n" << std::flush;
if (*linkSpeedName == '\0')
{
strcpy(linkSpeedName, "lan");
}
- #ifdef TEST
- *logofs << "Loop: Link speed is " << linkSpeedName
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Link speed is " << linkSpeedName
+ << ".\n" << std::flush;
if (strcasecmp(linkSpeedName, "modem") == 0)
{
@@ -12787,11 +11956,9 @@ int SetLink()
if (ParsePackMethod(packMethod, packQuality) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Unrecognized pack method id "
+ nxfatal << "Loop: PANIC! Unrecognized pack method id "
<< packMethod << " with quality " << packQuality
- << ".\n" << logofs_flush;
- #endif
+ << ".\n" << std::flush;
cerr << "Error" << ": Unrecognized pack method id "
<< packMethod << " with quality " << packQuality
@@ -12814,11 +11981,9 @@ int SetLink()
}
else
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Forcing taint of replies "
- << "with a proxy session.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Forcing taint of replies "
+ << "with a proxy session.\n"
+ << std::flush;
control -> TaintReplies = 1;
}
@@ -12842,11 +12007,9 @@ int SetLink()
if (control -> SessionMode == session_proxy)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Forcing flush on priority "
- << "with a proxy session.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Forcing flush on priority "
+ << "with a proxy session.\n"
+ << std::flush;
control -> FlushPriority = 1;
}
@@ -12860,10 +12023,8 @@ int SetLink()
int SetLinkModem()
{
- #ifdef TEST
- *logofs << "Loop: Setting parameters for MODEM.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting parameters for MODEM.\n"
+ << std::flush;
control -> LinkMode = LINK_TYPE_MODEM;
@@ -12890,10 +12051,8 @@ int SetLinkModem()
int SetLinkIsdn()
{
- #ifdef TEST
- *logofs << "Loop: Setting parameters for ISDN.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting parameters for ISDN.\n"
+ << std::flush;
control -> LinkMode = LINK_TYPE_ISDN;
@@ -12920,14 +12079,12 @@ int SetLinkIsdn()
int SetLinkAdsl()
{
- #ifdef TEST
- *logofs << "Loop: Setting parameters for ADSL.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting parameters for ADSL.\n"
+ << std::flush;
control -> LinkMode = LINK_TYPE_ADSL;
- control -> TokenSize = 512;
+ control -> TokenSize = 1408;
control -> TokenLimit = 24;
control -> SplitMode = 1;
@@ -12950,14 +12107,12 @@ int SetLinkAdsl()
int SetLinkWan()
{
- #ifdef TEST
- *logofs << "Loop: Setting parameters for WAN.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting parameters for WAN.\n"
+ << std::flush;
control -> LinkMode = LINK_TYPE_WAN;
- control -> TokenSize = 768;
+ control -> TokenSize = 1408;
control -> TokenLimit = 24;
control -> SplitMode = 1;
@@ -12980,10 +12135,8 @@ int SetLinkWan()
int SetLinkLan()
{
- #ifdef TEST
- *logofs << "Loop: Setting parameters for LAN.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting parameters for LAN.\n"
+ << std::flush;
control -> LinkMode = LINK_TYPE_LAN;
@@ -13240,12 +12393,10 @@ int SetLimits()
if (useStrict == 1)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: LIMIT! Decreasing the token limit "
- << "to " << control -> TokenLimit / 2
- << " with option 'strict'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: LIMIT! Decreasing the token limit "
+ << "to " << control -> TokenLimit / 2
+ << " with option 'strict'.\n"
+ << std::flush;
control -> TokenLimit /= 2;
}
@@ -13254,12 +12405,10 @@ int SetLimits()
control -> TokenLimit = 1;
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: WARNING! LIMIT! Setting the token limit "
- << "to " << control -> TokenLimit
- << " to simulate the proxy congestion.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! LIMIT! Setting the token limit "
+ << "to " << control -> TokenLimit
+ << " to simulate the proxy congestion.\n"
+ << std::flush;
#endif
@@ -13291,14 +12440,12 @@ int SetLimits()
}
}
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: LIMIT! Setting client bitrate limit "
- << "to " << control -> ClientBitrateLimit
- << " server bitrate limit to " << control ->
- ServerBitrateLimit << " with local limit "
- << control -> LocalBitrateLimit << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: LIMIT! Setting client bitrate limit "
+ << "to " << control -> ClientBitrateLimit
+ << " server bitrate limit to " << control ->
+ ServerBitrateLimit << " with local limit "
+ << control -> LocalBitrateLimit << ".\n"
+ << std::flush;
return 1;
}
@@ -13315,11 +12462,9 @@ int ParseCacheOption(const char *opt)
if (size < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid value '"
+ nxfatal << "Loop: PANIC! Invalid value '"
<< opt << "' for option 'cache'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Invalid value '"
<< opt << "' for option 'cache'.\n";
@@ -13327,10 +12472,8 @@ int ParseCacheOption(const char *opt)
return -1;
}
- #ifdef TEST
- *logofs << "Loop: Setting size of cache to "
- << size << " bytes.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting size of cache to "
+ << size << " bytes.\n" << std::flush;
control -> ClientTotalStorageSize = size;
control -> ServerTotalStorageSize = size;
@@ -13339,17 +12482,13 @@ int ParseCacheOption(const char *opt)
if (size == 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Disabling NX delta compression.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Disabling NX delta compression.\n"
+ << std::flush;
control -> LocalDeltaCompression = 0;
- #ifdef WARNING
- *logofs << "Loop: WARNING! Disabling use of NX persistent cache.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Disabling use of NX persistent cache.\n"
+ << std::flush;
control -> PersistentCacheEnableLoad = 0;
control -> PersistentCacheEnableSave = 0;
@@ -13364,11 +12503,9 @@ int ParseImagesOption(const char *opt)
if (size < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid value '"
+ nxfatal << "Loop: PANIC! Invalid value '"
<< opt << "' for option 'images'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Invalid value '"
<< opt << "' for option 'images'.\n";
@@ -13376,10 +12513,8 @@ int ParseImagesOption(const char *opt)
return -1;
}
- #ifdef TEST
- *logofs << "Loop: Setting size of images cache to "
- << size << " bytes.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting size of images cache to "
+ << size << " bytes.\n" << std::flush;
control -> ImageCacheDiskLimit = size;
@@ -13394,11 +12529,9 @@ int ParseShmemOption(const char *opt)
if (size < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid value '"
+ nxfatal << "Loop: PANIC! Invalid value '"
<< opt << "' for option 'shseg'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Invalid value '"
<< opt << "' for option 'shseg'.\n";
@@ -13409,11 +12542,9 @@ int ParseShmemOption(const char *opt)
control -> ShmemClientSize = size;
control -> ShmemServerSize = size;
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Set shared memory size to "
- << control -> ShmemServerSize << " bytes.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Set shared memory size to "
+ << control -> ShmemServerSize << " bytes.\n"
+ << std::flush;
strcpy(shsegSizeName, opt);
@@ -13426,11 +12557,9 @@ int ParseBitrateOption(const char *opt)
if (bitrate < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid value '"
+ nxfatal << "Loop: PANIC! Invalid value '"
<< opt << "' for option 'limit'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Invalid value '"
<< opt << "' for option 'limit'.\n";
@@ -13442,19 +12571,15 @@ int ParseBitrateOption(const char *opt)
if (bitrate == 0)
{
- #ifdef TEST
- *logofs << "Loop: Disabling bitrate limit on proxy link.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Disabling bitrate limit on proxy link.\n"
+ << std::flush;
control -> LocalBitrateLimit = 0;
}
else
{
- #ifdef TEST
- *logofs << "Loop: Setting bitrate to " << bitrate
- << " bits per second.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting bitrate to " << bitrate
+ << " bits per second.\n" << std::flush;
//
// Internal representation is in bytes
@@ -13467,29 +12592,23 @@ int ParseBitrateOption(const char *opt)
return 1;
}
-int ParseHostOption(const char *opt, char *host, int &port)
+int ParseHostOption(const char *opt, char *host, long &port)
{
- #ifdef TEST
- *logofs << "Loop: Trying to parse options string '" << opt
- << "' as a remote NX host.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Trying to parse options string '" << opt
+ << "' as a remote NX host.\n" << std::flush;
if (opt == NULL || *opt == '\0')
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! No host parameter provided.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! No host parameter provided.\n"
+ << std::flush;
return 0;
}
else if (strlen(opt) >= DEFAULT_STRING_LENGTH)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Host parameter exceeds length of "
+ nxfatal << "Loop: PANIC! Host parameter exceeds length of "
<< DEFAULT_STRING_LENGTH << " characters.\n"
- << logofs_flush;
- #endif
+ << std::flush;
return 0;
}
@@ -13501,7 +12620,7 @@ int ParseHostOption(const char *opt, char *host, int &port)
int newPort = port;
- const char *separator = rindex(opt, ':');
+ const char *separator = strrchr(opt, ':');
if (separator != NULL)
{
@@ -13517,10 +12636,8 @@ int ParseHostOption(const char *opt, char *host, int &port)
if (newPort < 0 || *check != '\0')
{
- #ifdef TEST
- *logofs << "Loop: Can't identify remote NX port in string '"
- << separator << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Can't identify remote NX port in string '"
+ << separator << "'.\n" << std::flush;
return 0;
}
@@ -13532,10 +12649,8 @@ int ParseHostOption(const char *opt, char *host, int &port)
// by other means.
//
- #ifdef TEST
- *logofs << "Loop: Can't identify remote NX port in string '"
- << opt << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Can't identify remote NX port in string '"
+ << opt << "'.\n" << std::flush;
return 0;
}
@@ -13560,22 +12675,18 @@ int ParseHostOption(const char *opt, char *host, int &port)
if (*check != '\0')
{
- #ifdef TEST
- *logofs << "Loop: Can't identify remote NX host in string '"
- << newHost << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Can't identify remote NX host in string '"
+ << newHost << "'.\n" << std::flush;
return 0;
}
else if (*acceptHost != '\0')
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't manage to connect and accept connections "
- << "at the same time.\n" << logofs_flush;
+ nxfatal << "Loop: PANIC! Can't manage to connect and accept connections "
+ << "at the same time.\n" << std::flush;
- *logofs << "Loop: PANIC! Refusing remote NX host with string '"
- << opt << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Refusing remote NX host with string '"
+ << opt << "'.\n" << std::flush;
cerr << "Error" << ": Can't manage to connect and accept connections "
<< "at the same time.\n";
@@ -13588,29 +12699,23 @@ int ParseHostOption(const char *opt, char *host, int &port)
if (*host != '\0' && strcmp(host, newHost) != 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Overriding remote NX host '"
- << host << "' with new value '" << newHost
- << "'.\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Overriding remote NX host '"
+ << host << "' with new value '" << newHost
+ << "'.\n" << std::flush;
}
strcpy(host, newHost);
if (port != -1 && port != newPort)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Overriding remote NX port '"
- << port << "' with new value '" << newPort
- << "'.\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Overriding remote NX port '"
+ << port << "' with new value '" << newPort
+ << "'.\n" << std::flush;
}
- #ifdef TEST
- *logofs << "Loop: Parsed options string '" << opt
- << "' with host '" << newHost << "' and port '"
- << newPort << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Parsed options string '" << opt
+ << "' with host '" << newHost << "' and port '"
+ << newPort << "'.\n" << std::flush;
port = newPort;
@@ -13628,10 +12733,8 @@ int ParseFontPath(char *path)
return 0;
}
- #ifdef TEST
- *logofs << "Loop: Parsing font server option '" << path
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Parsing font server option '" << path
+ << "'.\n" << std::flush;
//
// Convert the value to our default port.
@@ -13661,31 +12764,27 @@ int ParseFontPath(char *path)
if (atoi(path) > 0)
{
- #ifdef TEST
- *logofs << "Loop: Assuming numeric TCP port '" << atoi(path)
- << "' for font server.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming numeric TCP port '" << atoi(path)
+ << "' for font server.\n" << std::flush;
return 1;
}
//
// Let's assume that a port specification "unix/:7100"
- // corresponds to "$TEMP/.font-unix/fs7100" and a port
- // "unix/:-1" corresponds to "$TEMP/.font-unix/fs-1".
+ // corresponds to "/tmp/.font-unix/fs7100" and a port
+ // "unix/:-1" corresponds to "/tmp/.font-unix/fs-1".
//
if (strncmp("unix/:", path, 6) == 0)
{
- snprintf(path, DEFAULT_STRING_LENGTH - 1, "%s/.font-unix/fs%s",
- control -> TempPath, oldPath + 6);
+ snprintf(path, DEFAULT_STRING_LENGTH - 1, "/tmp/.font-unix/fs%s",
+ oldPath + 6);
*(path + DEFAULT_STRING_LENGTH - 1) = '\0';
- #ifdef TEST
- *logofs << "Loop: Assuming Unix socket '" << path
- << "' for font server.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming Unix socket '" << path
+ << "' for font server.\n" << std::flush;
}
else if (strncmp("tcp/:", path, 5) == 0)
{
@@ -13698,10 +12797,8 @@ int ParseFontPath(char *path)
goto ParseFontPathError;
}
- #ifdef TEST
- *logofs << "Loop: Assuming TCP port '" << atoi(path)
- << "' for font server.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming TCP port '" << atoi(path)
+ << "' for font server.\n" << std::flush;
}
else
{
@@ -13715,60 +12812,27 @@ int ParseFontPath(char *path)
goto ParseFontPathError;
}
- #ifdef TEST
- *logofs << "Loop: Assuming Unix socket '" << path
- << "' for font server.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Assuming Unix socket '" << path
+ << "' for font server.\n" << std::flush;
}
return 1;
ParseFontPathError:
- #ifdef TEST
- *logofs << "Loop: Unable to determine the font server "
- << "port in string '" << path << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Unable to determine the font server "
+ << "port in string '" << path << "'.\n"
+ << std::flush;
return -1;
}
-int ParseListenOption(int &address)
-{
- if (*listenHost == '\0')
- {
- //
- // On the X client side listen on any address.
- // On the X server side listen to the forwarder
- // on localhost.
- //
-
- if (control -> ProxyMode == proxy_server)
- {
- address = (int) inet_addr("127.0.0.1");
- }
- else
- {
- address = htonl(INADDR_ANY);
- }
- }
- else
- {
- address = inet_addr(listenHost);
- }
-
- return 1;
-}
-
int OpenLogFile(char *name, ostream *&stream)
{
if (name == NULL || *name == '\0')
{
- #ifdef TEST
- *logofs << "Loop: WARNING! No name provided for output. Using standard error.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! No name provided for output. Using standard error.\n"
+ << std::flush;
if (stream == NULL)
{
@@ -13786,10 +12850,8 @@ int OpenLogFile(char *name, ostream *&stream)
if (filePath == NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Cannot determine directory of NX session file.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Cannot determine directory of NX session file.\n"
+ << std::flush;
cerr << "Error" << ": Cannot determine directory of NX session file.\n";
@@ -13799,11 +12861,9 @@ int OpenLogFile(char *name, ostream *&stream)
if (strlen(filePath) + strlen("/") +
strlen(name) + 1 > DEFAULT_STRING_LENGTH)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Full name of NX file '" << name
+ nxfatal << "Loop: PANIC! Full name of NX file '" << name
<< " would exceed length of " << DEFAULT_STRING_LENGTH
- << " characters.\n" << logofs_flush;
- #endif
+ << " characters.\n" << std::flush;
cerr << "Error" << ": Full name of NX file '" << name
<< " would exceed length of " << DEFAULT_STRING_LENGTH
@@ -13845,10 +12905,8 @@ int OpenLogFile(char *name, ostream *&stream)
}
else
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Bad stream provided for output.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Bad stream provided for output.\n"
+ << std::flush;
cerr << "Error" << ": Bad stream provided for output.\n";
@@ -13873,11 +12931,9 @@ int ReopenLogFile(char *name, ostream *&stream, int limit)
if (stat(name, &fileStat) != 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Can't get stats of file '"
- << name << "'. Error is " << EGET()
- << " '" << ESTR() << "'.\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Can't get stats of file '"
+ << name << "'. Error is " << EGET()
+ << " '" << ESTR() << "'.\n" << std::flush;
return 0;
}
@@ -13887,11 +12943,9 @@ int ReopenLogFile(char *name, ostream *&stream, int limit)
}
}
- #ifdef TEST
- *logofs << "Loop: Deleting file '" << name
- << "' with size " << fileStat.st_size
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Deleting file '" << name
+ << "' with size " << fileStat.st_size
+ << ".\n" << std::flush;
//
// Create a new stream over the previous
@@ -13917,10 +12971,8 @@ int ReopenLogFile(char *name, ostream *&stream, int limit)
umask(fileMode);
- #ifdef TEST
- *logofs << "Loop: Reopened file '" << name
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Reopened file '" << name
+ << "'.\n" << std::flush;
}
return 1;
@@ -13930,12 +12982,18 @@ void PrintProcessInfo()
{
if (agent == NULL)
{
- cerr << "\nNXPROXY - Version " << control -> LocalVersionMajor
- << "." << control -> LocalVersionMinor << "."
- << control -> LocalVersionPatch << "\n\n";
- cerr << "Copyright (C) 2001, 2010 NoMachine.\n"
- << "See http://www.nomachine.com/ for more information.\n\n";
+ cerr << endl;
+
+ PrintVersionInfo();
+
+ cerr << endl;
+
+ cerr << GetCopyrightInfo()
+ << endl
+ << GetOtherCopyrightInfo()
+ << endl
+ << "See https://github.com/ArcticaProject/nx-libs for more information." << endl << endl;
}
//
@@ -13946,7 +13004,7 @@ void PrintProcessInfo()
//
cerr << "Info: Proxy running in "
- << (control -> ProxyMode == proxy_client ? "server" : "client")
+ << (control -> ProxyMode == proxy_client ? "client" : "server")
<< " mode with pid '" << getpid() << "'.\n";
if (agent == NULL)
@@ -13955,7 +13013,6 @@ void PrintProcessInfo()
<< strTimestamp() << "'.\n";
}
- #ifdef TEST
if (*errorsFileName != '\0')
{
@@ -13967,7 +13024,6 @@ void PrintProcessInfo()
cerr << "Info" << ": Using stats file '" << statsFileName << "'.\n";
}
- #endif
}
void PrintConnectionInfo()
@@ -14100,65 +13156,65 @@ void PrintConnectionInfo()
}
if (control -> ProxyMode == proxy_client &&
- useCupsSocket > 0 && cupsPort > 0)
+ useCupsSocket > 0 && cupsPort.enabled())
{
cerr << "Info" << ": Listening to CUPS connections "
<< "on port '" << cupsPort << "'.\n";
}
else if (control -> ProxyMode == proxy_server &&
- cupsPort > 0)
+ cupsPort.enabled())
{
cerr << "Info" << ": Forwarding CUPS connections "
<< "to port '" << cupsPort << "'.\n";
}
if (control -> ProxyMode == proxy_client &&
- useAuxSocket > 0 && auxPort > 0)
+ useAuxSocket > 0 && auxPort.enabled())
{
cerr << "Info" << ": Listening to auxiliary X11 connections "
<< "on port '" << auxPort << "'.\n";
}
else if (control -> ProxyMode == proxy_server &&
- auxPort > 0)
+ auxPort.enabled())
{
cerr << "Info" << ": Forwarding auxiliary X11 connections "
<< "to display '" << displayHost << "'.\n";
}
if (control -> ProxyMode == proxy_client &&
- useSmbSocket > 0 && smbPort > 0)
+ useSmbSocket > 0 && smbPort.enabled())
{
cerr << "Info" << ": Listening to SMB connections "
<< "on port '" << smbPort << "'.\n";
}
else if (control -> ProxyMode == proxy_server &&
- smbPort > 0)
+ smbPort.enabled())
{
cerr << "Info" << ": Forwarding SMB connections "
<< "to port '" << smbPort << "'.\n";
}
if (control -> ProxyMode == proxy_client &&
- useMediaSocket > 0 && mediaPort > 0)
+ useMediaSocket > 0 && mediaPort.enabled())
{
cerr << "Info" << ": Listening to multimedia connections "
<< "on port '" << mediaPort << "'.\n";
}
else if (control -> ProxyMode == proxy_server &&
- mediaPort > 0)
+ mediaPort.enabled())
{
cerr << "Info" << ": Forwarding multimedia connections "
<< "to port '" << mediaPort << "'.\n";
}
if (control -> ProxyMode == proxy_client &&
- useHttpSocket > 0 && httpPort > 0)
+ useHttpSocket > 0 && httpPort.enabled())
{
cerr << "Info" << ": Listening to HTTP connections "
<< "on port '" << httpPort << "'.\n";
}
else if (control -> ProxyMode == proxy_server &&
- httpPort > 0)
+ httpPort.enabled())
{
cerr << "Info" << ": Forwarding HTTP connections "
<< "to port '" << httpPort << "'.\n";
@@ -14177,7 +13233,7 @@ void PrintConnectionInfo()
<< "to port '" << fontPort << "'.\n";
}
- if (useSlaveSocket > 0 && slavePort > 0)
+ if (useSlaveSocket > 0 && slavePort.enabled())
{
cerr << "Info" << ": Listening to slave connections "
<< "on port '" << slavePort << "'.\n";
@@ -14189,7 +13245,8 @@ void PrintVersionInfo()
cerr << "NXPROXY - " << "Version "
<< control -> LocalVersionMajor << "."
<< control -> LocalVersionMinor << "."
- << control -> LocalVersionPatch;
+ << control -> LocalVersionPatch << "."
+ << control -> LocalVersionMaintenancePatch;
cerr << endl;
}
@@ -14219,12 +13276,10 @@ void PrintOptionIgnored(const char *type, const char *name, const char *value)
{
if (control -> ProxyMode == proxy_server)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Ignoring " << type
- << " option '" << name << "' with value '"
- << value << "' at " << "NX client side.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Ignoring " << type
+ << " option '" << name << "' with value '"
+ << value << "' at " << "NX client side.\n"
+ << std::flush;
cerr << "Warning" << ": Ignoring " << type
<< " option '" << name << "' with value '"
@@ -14232,12 +13287,10 @@ void PrintOptionIgnored(const char *type, const char *name, const char *value)
}
else
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Ignoring " << type
- << " option '" << name << "' with value '"
- << value << "' at " << "NX server side.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Ignoring " << type
+ << " option '" << name << "' with value '"
+ << value << "' at " << "NX server side.\n"
+ << std::flush;
cerr << "Warning" << ": Ignoring " << type
<< " option '" << name << "' with value '"
@@ -14253,11 +13306,9 @@ const char *GetOptions(const char *options)
strncasecmp(options, "nx,", 3) != 0 &&
strncasecmp(options, "nx:", 3) != 0)
{
- #ifdef TEST
- *logofs << "Loop: PANIC! Display options string '" << options
- << "' must start with 'nx' or 'nx/nx' prefix.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: PANIC! Display options string '" << options
+ << "' must start with 'nx' or 'nx/nx' prefix.\n"
+ << std::flush;
cerr << "Error" << ": Display options string '" << options
<< "' must start with 'nx' or 'nx/nx' prefix.\n";
@@ -14302,19 +13353,15 @@ const char *GetArg(int &argi, int argc, const char **argv)
int CheckArg(const char *type, const char *name, const char *value)
{
- #ifdef TEST
- *logofs << "Loop: Parsing " << type << " option '" << name
- << "' with value '" << (value ? value : "(null)")
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Parsing " << type << " option '" << name
+ << "' with value '" << (value ? value : "(null)")
+ << "'.\n" << std::flush;
if (value == NULL || strstr(value, "=") != NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Error in " << type << " option '"
+ nxfatal << "Loop: PANIC! Error in " << type << " option '"
<< name << "'. No value found.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Error in " << type << " option '"
<< name << "'. No value found.\n";
@@ -14323,10 +13370,8 @@ int CheckArg(const char *type, const char *name, const char *value)
}
else if (strstr(name, ",") != NULL)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Parse error at " << type << " option '"
- << name << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Parse error at " << type << " option '"
+ << name << "'.\n" << std::flush;
cerr << "Error" << ": Parse error at " << type << " option '"
<< name << "'.\n";
@@ -14335,12 +13380,10 @@ int CheckArg(const char *type, const char *name, const char *value)
}
else if (strlen(value) >= DEFAULT_STRING_LENGTH)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Value '" << value << "' of "
+ nxfatal << "Loop: PANIC! Value '" << value << "' of "
<< type << " option '" << name << "' exceeds length of "
<< DEFAULT_STRING_LENGTH << " characters.\n"
- << logofs_flush;
- #endif
+ << std::flush;
cerr << "Error" << ": Value '" << value << "' of "
<< type << " option '" << name << "' exceeds length of "
@@ -14394,10 +13437,9 @@ int ParseArg(const char *type, const char *name, const char *value)
*(string + (strlen(value) - 1)) = '\0';
- #ifdef TEST
- *logofs << "Loop: Parsing integer option '" << name
- << "' from string '" << string << "' with base set to ";
+ nxinfo << "Loop: Parsing integer option '" << name
+ << "' from string '" << string << "' with base set to ";
switch (tolower(*id))
{
@@ -14405,14 +13447,13 @@ int ParseArg(const char *type, const char *name, const char *value)
case 'm':
case 'g':
{
- *logofs << (char) toupper(*id);
+ nxinfo << (char) toupper(*id);
+ break;
}
- break;
}
- *logofs << ".\n" << logofs_flush;
+ nxinfo << ".\n" << std::flush;
- #endif
double result = atof(string) * base;
@@ -14425,25 +13466,38 @@ int ParseArg(const char *type, const char *name, const char *value)
delete [] string;
- #ifdef TEST
- *logofs << "Loop: Integer option parsed to '"
- << (int) result << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Integer option parsed to '"
+ << (int) result << "'.\n" << std::flush;
return (int) result;
}
+void SetAndValidateChannelEndPointArg(const char *type, const char *name, const char *value,
+ ChannelEndPoint &endPoint) {
+ endPoint.setSpec(value);
+ if (!endPoint.validateSpec()) {
+ nxfatal << "Loop: PANIC! Invalid " << type
+ << " option '" << name << "' with value '"
+ << value << "'.\n" << std::flush;
+
+ cerr << "Error" << ": Invalid " << type
+ << " option '" << name << "' with value '"
+ << value << "'.\n";
+
+ HandleCleanup();
+ }
+}
+
+
int ValidateArg(const char *type, const char *name, const char *value)
{
int number = atoi(value);
if (number < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Invalid " << type
+ nxfatal << "Loop: PANIC! Invalid " << type
<< " option '" << name << "' with value '"
- << value << "'.\n" << logofs_flush;
- #endif
+ << value << "'.\n" << std::flush;
cerr << "Error" << ": Invalid " << type
<< " option '" << name << "' with value '"
@@ -14548,20 +13602,16 @@ static void handleCheckSessionInLoop()
if (proxy -> getShutdown() > 0)
{
- #ifdef TEST
- *logofs << "Loop: End of NX transport requested "
- << "by remote.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: End of NX transport requested "
+ << "by remote.\n" << std::flush;
handleTerminatingInLoop();
if (control -> ProxyMode == proxy_server)
{
- #ifdef TEST
- *logofs << "Loop: Bytes received so far are "
- << (unsigned long long) statistics -> getBytesIn()
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Bytes received so far are "
+ << (unsigned long long) statistics -> getBytesIn()
+ << ".\n" << std::flush;
if (statistics -> getBytesIn() < 1024)
{
@@ -14574,20 +13624,16 @@ static void handleCheckSessionInLoop()
}
}
- #ifdef TEST
- *logofs << "Loop: Shutting down the NX transport.\n"
- << logofs_flush;
- #endif
-
+ nxinfo << "Loop: Shutting down the NX transport.\n"
+ << std::flush;
+
HandleCleanup();
}
else if (proxy -> handlePing() < 0)
{
- #ifdef TEST
- *logofs << "Loop: Failure handling the ping for "
- << "proxy FD#" << proxyFD << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Failure handling the ping for "
+ << "proxy FD#" << proxyFD << ".\n"
+ << std::flush;
HandleShutdown();
}
@@ -14600,18 +13646,14 @@ static void handleCheckSessionInLoop()
if (IsRunning(lastWatchdog) && CheckProcess(lastWatchdog, "watchdog") == 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Watchdog is gone unnoticed. "
- << "Setting the last signal to SIGTERM.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Watchdog is gone unnoticed. "
+ << "Setting the last signal to SIGTERM.\n"
+ << std::flush;
lastSignal = SIGTERM;
- #ifdef WARNING
- *logofs << "Loop: WARNING! Resetting pid of last "
- << "watchdog process.\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Resetting pid of last "
+ << "watchdog process.\n" << std::flush;
SetNotRunning(lastWatchdog);
}
@@ -14629,16 +13671,12 @@ static void handleCheckSessionInLoop()
agent != NULL && proxy -> getType(agentFD[1]) ==
channel_none && lastKill == 0 && lastDestroy == 1)
{
- #ifdef TEST
- *logofs << "Loop: End of NX transport requested "
- << "by agent.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: End of NX transport requested "
+ << "by agent.\n" << std::flush;
- #ifdef TEST
- *logofs << "Loop: Bytes sent so far are "
- << (unsigned long long) statistics -> getBytesOut()
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Bytes sent so far are "
+ << (unsigned long long) statistics -> getBytesOut()
+ << ".\n" << std::flush;
if (statistics -> getBytesOut() < 1024)
{
@@ -14703,11 +13741,9 @@ static void handleCheckSessionInLoop()
if (signal != 0)
{
- #ifdef TEST
- *logofs << "Loop: End of NX transport requested by signal '"
- << signal << "' '" << DumpSignal(signal)
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: End of NX transport requested by signal '"
+ << signal << "' '" << DumpSignal(signal)
+ << "'.\n" << std::flush;
handleTerminatingInLoop();
}
@@ -14736,10 +13772,8 @@ static void handleCheckSessionInLoop()
}
else if (lastKill == 2)
{
- #ifdef TEST
- *logofs << "Loop: Shutting down the NX transport.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Shutting down the NX transport.\n"
+ << std::flush;
proxy -> handleShutdown();
@@ -14772,49 +13806,39 @@ static void handleCheckSessionInLoop()
timeout = 500;
}
- #ifdef TEST
- *logofs << "Loop: Starting watchdog process with timeout "
- << "of " << timeout << " Ms.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Starting watchdog process with timeout "
+ << "of " << timeout << " ms.\n"
+ << std::flush;
}
- #ifdef TEST
else
{
- *logofs << "Loop: Starting watchdog process without "
- << "a timeout.\n" << logofs_flush;
+ nxinfo << "Loop: Starting watchdog process without "
+ << "a timeout.\n" << std::flush;
}
- #endif
lastWatchdog = NXTransWatchdog(timeout);
if (IsFailed(lastWatchdog))
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't start the NX watchdog "
- << "process in shutdown.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't start the NX watchdog "
+ << "process in shutdown.\n" << std::flush;
cerr << "Error" << ": Can't start the NX watchdog "
<< "process in shutdown.\n";
HandleCleanup();
}
- #ifdef TEST
else
{
- *logofs << "Loop: Watchdog started with pid '"
- << lastWatchdog << "'.\n" << logofs_flush;
+ nxinfo << "Loop: Watchdog started with pid '"
+ << lastWatchdog << "'.\n" << std::flush;
}
- #endif
}
else
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Previous watchdog detected "
+ nxfatal << "Loop: PANIC! Previous watchdog detected "
<< "in shutdown with pid '" << lastWatchdog
- << "'.\n" << logofs_flush;
- #endif
+ << "'.\n" << std::flush;
cerr << "Error" << ": Previous watchdog detected "
<< "in shutdown with pid '" << lastWatchdog
@@ -14825,10 +13849,8 @@ static void handleCheckSessionInLoop()
if (control -> CleanupTimeout > 0)
{
- #ifdef TEST
- *logofs << "Loop: Waiting the cleanup timeout to complete.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Waiting the cleanup timeout to complete.\n"
+ << std::flush;
cerr << "Info" << ": Waiting the cleanup timeout to complete.\n";
}
@@ -14843,10 +13865,8 @@ static void handleCheckSessionInLoop()
cerr << "Info" << ": Watchdog running with pid '" << lastWatchdog
<< "'.\n";
- #ifdef TEST
- *logofs << "Loop: Waiting the watchdog process to complete.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Waiting the watchdog process to complete.\n"
+ << std::flush;
cerr << "Info" << ": Waiting the watchdog process to complete.\n";
}
@@ -14859,13 +13879,11 @@ static void handleCheckBitrateInLoop()
{
static long int slept = 0;
- #ifdef TEST
- *logofs << "Loop: Bitrate is " << statistics -> getBitrateInShortFrame()
- << " B/s and " << statistics -> getBitrateInLongFrame()
- << " B/s in " << control -> ShortBitrateTimeFrame / 1000
- << "/" << control -> LongBitrateTimeFrame / 1000
- << " seconds timeframes.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Bitrate is " << statistics -> getBitrateInShortFrame()
+ << " B/s and " << statistics -> getBitrateInLongFrame()
+ << " B/s in " << control -> ShortBitrateTimeFrame / 1000
+ << "/" << control -> LongBitrateTimeFrame / 1000
+ << " seconds timeframes.\n" << std::flush;
//
// This can be improved. We may not jump out
@@ -14875,11 +13893,9 @@ static void handleCheckBitrateInLoop()
if (control -> LocalBitrateLimit > 0)
{
- #ifdef TEST
- *logofs << "Loop: Calculating bandwidth usage with limit "
- << control -> LocalBitrateLimit << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Calculating bandwidth usage with limit "
+ << control -> LocalBitrateLimit << ".\n"
+ << std::flush;
int reference = (statistics -> getBitrateInLongFrame() +
statistics -> getBitrateInShortFrame()) / 2;
@@ -14898,11 +13914,9 @@ static void handleCheckBitrateInLoop()
if (slept > 2000)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Sleeping due to "
- << "reference bitrate of " << reference
- << " B/s.\n" << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Sleeping due to "
+ << "reference bitrate of " << reference
+ << " B/s.\n" << std::flush;
cerr << "Warning" << ": Sleeping due to "
<< "reference bitrate of " << reference
@@ -14924,7 +13938,6 @@ static void handleCheckBitrateInLoop()
}
}
-#if defined(TEST) || defined(INFO)
static void handleCheckStateInLoop(int &setFDs)
{
@@ -14937,14 +13950,11 @@ static void handleCheckStateInLoop(int &setFDs)
if (j != proxyFD)
{
fdPending = proxy -> getPending(j);
-
if (fdPending > 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Buffer for descriptor FD#"
+ nxfatal << "Loop: PANIC! Buffer for descriptor FD#"
<< j << " has pending bytes to read.\n"
- << logofs_flush;
- #endif
+ << std::flush;
HandleCleanup();
}
@@ -14953,11 +13963,9 @@ static void handleCheckStateInLoop(int &setFDs)
if (fdLength > 0)
{
- #ifdef TEST
- *logofs << "Loop: WARNING! Buffer for descriptor FD#"
- << j << " has " << fdLength << " bytes to write.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! Buffer for descriptor FD#"
+ << j << " has " << fdLength << " bytes to write.\n"
+ << std::flush;
}
}
}
@@ -14966,11 +13974,9 @@ static void handleCheckStateInLoop(int &setFDs)
if (fdPending > 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Buffer for proxy descriptor FD#"
+ nxfatal << "Loop: PANIC! Buffer for proxy descriptor FD#"
<< proxyFD << " has pending bytes to read.\n"
- << logofs_flush;
- #endif
+ << std::flush;
HandleCleanup();
}
@@ -14982,22 +13988,18 @@ static void handleCheckStateInLoop(int &setFDs)
if (control -> FlushPolicy == policy_immediate &&
proxy -> getBlocked(proxyFD) == 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Buffer for proxy descriptor FD#"
+ nxfatal << "Loop: PANIC! Buffer for proxy descriptor FD#"
<< proxyFD << " has " << fdLength << " bytes "
<< "to write with policy 'immediate'.\n"
- << logofs_flush;
- #endif
+ << std::flush;
HandleCleanup();
}
else
{
- #ifdef TEST
- *logofs << "Loop: WARNING! Buffer for proxy descriptor FD#"
- << proxyFD << " has " << fdLength << " bytes "
- << "to write.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: WARNING! Buffer for proxy descriptor FD#"
+ << proxyFD << " has " << fdLength << " bytes "
+ << "to write.\n" << std::flush;
}
}
@@ -15005,22 +14007,18 @@ static void handleCheckStateInLoop(int &setFDs)
if (fdSplits > 0)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! Proxy descriptor FD#" << proxyFD
- << " has " << fdSplits << " splits to send.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! Proxy descriptor FD#" << proxyFD
+ << " has " << fdSplits << " splits to send.\n"
+ << std::flush;
}
}
static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet,
fd_set &writeSet, T_timestamp selectTs)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Maximum descriptors is ["
- << setFDs << "] at " << strMsTimestamp()
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Maximum descriptors is ["
+ << setFDs << "] at " << strMsTimestamp()
+ << ".\n" << std::flush;
int i;
@@ -15028,17 +14026,13 @@ static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet,
{
i = 0;
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Selected for read are ";
- #endif
+ nxinfo << "Loop: Selected for read are ";
for (int j = 0; j < setFDs; j++)
{
if (FD_ISSET(j, &readSet))
{
- #if defined(TEST) || defined(INFO)
- *logofs << "[" << j << "]" << logofs_flush;
- #endif
+ nxinfo << "[" << j << "]" << std::flush;
i++;
}
@@ -15046,30 +14040,22 @@ static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet,
if (i > 0)
{
- #if defined(TEST) || defined(INFO)
- *logofs << ".\n" << logofs_flush;
- #endif
+ nxinfo << ".\n" << std::flush;
}
else
{
- #if defined(TEST) || defined(INFO)
- *logofs << "[none].\n" << logofs_flush;
- #endif
+ nxinfo << "[none].\n" << std::flush;
}
i = 0;
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Selected for write are ";
- #endif
+ nxinfo << "Loop: Selected for write are ";
for (int j = 0; j < setFDs; j++)
{
if (FD_ISSET(j, &writeSet))
{
- #if defined(TEST) || defined(INFO)
- *logofs << "[" << j << "]" << logofs_flush;
- #endif
+ nxinfo << "[" << j << "]" << std::flush;
i++;
}
@@ -15077,51 +14063,43 @@ static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet,
if (i > 0)
{
- #if defined(TEST) || defined(INFO)
- *logofs << ".\n" << logofs_flush;
- #endif
+ nxinfo << ".\n" << std::flush;
}
else
{
- #if defined(TEST) || defined(INFO)
- *logofs << "[none].\n" << logofs_flush;
- #endif
+ nxinfo << "[none].\n" << std::flush;
}
}
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Select timeout is "
- << selectTs.tv_sec << " S and "
- << (double) selectTs.tv_usec / 1000
- << " Ms.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Select timeout is "
+ << selectTs.tv_sec << " s and "
+ << (double) selectTs.tv_usec / 1000
+ << " ms.\n" << std::flush;
}
static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet,
fd_set &writeSet, struct timeval &selectTs,
- struct timeval &startTs)
+ struct timeval &pstartTs)
{
- int diffTs = diffTimestamp(startTs, getNewTimestamp());
+ int diffTs = diffTimestamp(pstartTs, getNewTimestamp());
- #if defined(TEST) || defined(INFO)
if (diffTs >= (control -> PingTimeout -
(control -> LatencyTimeout * 4)))
{
- *logofs << "Loop: Select result is [" << resultFDs
- << "] at " << strMsTimestamp() << " with no "
- << "communication within " << diffTs
- << " Ms.\n" << logofs_flush;
+ nxinfo << "Loop: Select result is [" << resultFDs
+ << "] at " << strMsTimestamp() << " with no "
+ << "communication within " << diffTs
+ << " ms.\n" << std::flush;
}
else
{
- *logofs << "Loop: Select result is [" << resultFDs
- << "] error is [" << errorFDs << "] at "
- << strMsTimestamp() << " after " << diffTs
- << " Ms.\n" << logofs_flush;
+ nxinfo << "Loop: Select result is [" << resultFDs
+ << "] error is [" << errorFDs << "] at "
+ << strMsTimestamp() << " after " << diffTs
+ << " ms.\n" << std::flush;
}
- #endif
int i;
@@ -15129,17 +14107,13 @@ static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs,
{
i = 0;
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Selected for read are ";
- #endif
+ nxinfo << "Loop: Selected for read are ";
for (int j = 0; j < setFDs; j++)
{
if (FD_ISSET(j, &readSet))
{
- #if defined(TEST) || defined(INFO)
- *logofs << "[" << j << "]" << logofs_flush;
- #endif
+ nxinfo << "[" << j << "]" << std::flush;
i++;
}
@@ -15147,30 +14121,22 @@ static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs,
if (i > 0)
{
- #if defined(TEST) || defined(INFO)
- *logofs << ".\n" << logofs_flush;
- #endif
+ nxinfo << ".\n" << std::flush;
}
else
{
- #if defined(TEST) || defined(INFO)
- *logofs << "[none].\n" << logofs_flush;
- #endif
+ nxinfo << "[none].\n" << std::flush;
}
i = 0;
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Selected for write are ";
- #endif
+ nxinfo << "Loop: Selected for write are ";
for (int j = 0; j < setFDs; j++)
{
if (FD_ISSET(j, &writeSet))
{
- #if defined(TEST) || defined(INFO)
- *logofs << "[" << j << "]" << logofs_flush;
- #endif
+ nxinfo << "[" << j << "]" << std::flush;
i++;
}
@@ -15178,27 +14144,20 @@ static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs,
if (i > 0)
{
- #if defined(TEST) || defined(INFO)
- *logofs << ".\n" << logofs_flush;
- #endif
+ nxinfo << ".\n" << std::flush;
}
else
{
- #if defined(TEST) || defined(INFO)
- *logofs << "[none].\n" << logofs_flush;
- #endif
+ nxinfo << "[none].\n" << std::flush;
}
}
}
-#endif
static void handleCheckSessionInConnect()
{
- #ifdef TEST
- *logofs << "Loop: Going to check session in connect.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to check session in connect.\n"
+ << std::flush;
if (control -> ProxyMode == proxy_client)
{
@@ -15242,11 +14201,9 @@ static void handleStatisticsInLoop()
if (mode == TOTAL_STATS || mode == PARTIAL_STATS)
{
- #ifdef TEST
- *logofs << "Loop: Going to request proxy statistics "
- << "with signal '" << DumpSignal(lastSignal)
- << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to request proxy statistics "
+ << "with signal '" << DumpSignal(lastSignal)
+ << "'.\n" << std::flush;
if (proxy != NULL)
{
@@ -15268,22 +14225,18 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
while (yield == 0)
{
- #ifdef TEST
- *logofs << "Loop: Going to run a new negotiation loop "
- << "with stage " << control -> ProxyStage
- << " at " << strMsTimestamp() << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Going to run a new negotiation loop "
+ << "with stage " << control -> ProxyStage
+ << " at " << strMsTimestamp() << ".\n"
+ << std::flush;
switch (control -> ProxyStage)
{
case stage_undefined:
{
- #ifdef TEST
- *logofs << "Loop: Handling negotiation with '"
- << "stage_undefined" << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling negotiation with '"
+ << "stage_undefined" << "'.\n"
+ << std::flush;
control -> ProxyStage = stage_initializing;
@@ -15291,11 +14244,9 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
}
case stage_initializing:
{
- #ifdef TEST
- *logofs << "Loop: Handling negotiation with '"
- << "stage_initializing" << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling negotiation with '"
+ << "stage_initializing" << "'.\n"
+ << std::flush;
InitBeforeNegotiation();
@@ -15305,11 +14256,9 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
}
case stage_connecting:
{
- #ifdef TEST
- *logofs << "Loop: Handling negotiation with '"
- << "stage_connecting" << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling negotiation with '"
+ << "stage_connecting" << "'.\n"
+ << std::flush;
SetupProxyConnection();
@@ -15319,11 +14268,9 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
}
case stage_connected:
{
- #ifdef TEST
- *logofs << "Loop: Handling negotiation with '"
- << "stage_connected" << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling negotiation with '"
+ << "stage_connected" << "'.\n"
+ << std::flush;
//
// Server side proxy must always be the one that
@@ -15364,11 +14311,9 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
}
case stage_sending_proxy_options:
{
- #ifdef TEST
- *logofs << "Loop: Handling negotiation with '"
- << "stage_sending_proxy_options" << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling negotiation with '"
+ << "stage_sending_proxy_options" << "'.\n"
+ << std::flush;
if (SendProxyOptions(proxyFD) < 0)
{
@@ -15388,11 +14333,9 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
}
case stage_waiting_forwarder_version:
{
- #ifdef TEST
- *logofs << "Loop: Handling negotiation with '"
- << "stage_waiting_forwarder_version" << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling negotiation with '"
+ << "stage_waiting_forwarder_version" << "'.\n"
+ << std::flush;
int result = ReadForwarderVersion(proxyFD);
@@ -15413,11 +14356,9 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
}
case stage_waiting_forwarder_options:
{
- #ifdef TEST
- *logofs << "Loop: Handling negotiation with '"
- << "stage_waiting_forwarder_options" << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling negotiation with '"
+ << "stage_waiting_forwarder_options" << "'.\n"
+ << std::flush;
int result = ReadForwarderOptions(proxyFD);
@@ -15438,11 +14379,9 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
}
case stage_waiting_proxy_version:
{
- #ifdef TEST
- *logofs << "Loop: Handling negotiation with '"
- << "stage_waiting_proxy_version" << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling negotiation with '"
+ << "stage_waiting_proxy_version" << "'.\n"
+ << std::flush;
int result = ReadProxyVersion(proxyFD);
@@ -15463,11 +14402,9 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
}
case stage_waiting_proxy_options:
{
- #ifdef TEST
- *logofs << "Loop: Handling negotiation with '"
- << "stage_waiting_proxy_options" << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling negotiation with '"
+ << "stage_waiting_proxy_options" << "'.\n"
+ << std::flush;
int result = ReadProxyOptions(proxyFD);
@@ -15495,11 +14432,9 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
}
case stage_sending_proxy_caches:
{
- #ifdef TEST
- *logofs << "Loop: Handling negotiation with '"
- << "stage_sending_proxy_caches" << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling negotiation with '"
+ << "stage_sending_proxy_caches" << "'.\n"
+ << std::flush;
if (SendProxyCaches(proxyFD) < 0)
{
@@ -15519,11 +14454,9 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
}
case stage_waiting_proxy_caches:
{
- #ifdef TEST
- *logofs << "Loop: Handling negotiation with '"
- << "stage_waiting_proxy_caches" << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling negotiation with '"
+ << "stage_waiting_proxy_caches" << "'.\n"
+ << std::flush;
int result = ReadProxyCaches(proxyFD);
@@ -15551,11 +14484,9 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
}
case stage_operational:
{
- #ifdef TEST
- *logofs << "Loop: Handling negotiation with '"
- << "stage_operational" << "'.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling negotiation with '"
+ << "stage_operational" << "'.\n"
+ << std::flush;
InitAfterNegotiation();
@@ -15565,10 +14496,8 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
}
default:
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Unmanaged case '" << control -> ProxyStage
- << "' while handling negotiation.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Unmanaged case '" << control -> ProxyStage
+ << "' while handling negotiation.\n" << std::flush;
cerr << "Error" << ": Unmanaged case '" << control -> ProxyStage
<< "' while handling negotiation.\n";
@@ -15602,20 +14531,16 @@ static void handleNegotiationInLoop(int &setFDs, fd_set &readSet,
setMinTimestamp(selectTs, control -> PingTimeout);
- #ifdef TEST
- *logofs << "Loop: Selected proxy FD#" << proxyFD << " in negotiation "
- << "phase with timeout of " << selectTs.tv_sec << " S and "
- << selectTs.tv_usec << " Ms.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Selected proxy FD#" << proxyFD << " in negotiation "
+ << "phase with timeout of " << selectTs.tv_sec << " s and "
+ << selectTs.tv_usec << " ms.\n" << std::flush;
return;
handleNegotiationInLoopError:
- #ifdef PANIC
- *logofs << "Loop: PANIC! Failure negotiating the session in stage '"
- << control -> ProxyStage << "'.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Failure negotiating the session in stage '"
+ << control -> ProxyStage << "'.\n" << std::flush;
cerr << "Error" << ": Failure negotiating the session in stage '"
<< control -> ProxyStage << "'.\n";
@@ -15624,10 +14549,8 @@ handleNegotiationInLoopError:
if (control -> ProxyMode == proxy_server &&
control -> ProxyStage == stage_waiting_proxy_version)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Wrong version or invalid session "
- << "authentication cookie.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Wrong version or invalid session "
+ << "authentication cookie.\n" << std::flush;
cerr << "Error" << ": Wrong version or invalid session "
<< "authentication cookie.\n";
@@ -15679,29 +14602,19 @@ static void handleAlertInLoop()
return;
}
- if (lastAlert.local == 0 &&
- (lastAlert.code > LAST_PROTO_STEP_6_ALERT &&
- control -> isProtoStep7() == 0))
- {
- //
- // The remote proxy would be unable
- // to handle the alert.
- //
+ //
+ // Since ProtoStep7 (#issue 108)
+ //
+ // Now the remote proxy should always
+ // be able to handle the alert
+ //
- #ifdef WARNING
- *logofs << "Loop: WARNING! Ignoring unsupported alert "
- << "with code '" << lastAlert.code << "'.\n"
- << logofs_flush;
- #endif
- }
- else if (lastAlert.local == 0)
+ if (lastAlert.local == 0)
{
if (proxy != NULL)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Requesting a remote alert with code '"
- << lastAlert.code << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Requesting a remote alert with code '"
+ << lastAlert.code << "'.\n" << std::flush;
if (proxy -> handleAlert(lastAlert.code) < 0)
{
@@ -15711,10 +14624,8 @@ static void handleAlertInLoop()
}
else
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Handling a local alert with code '"
- << lastAlert.code << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Handling a local alert with code '"
+ << lastAlert.code << "'.\n" << std::flush;
if (control -> ProxyMode == proxy_client)
{
@@ -15948,22 +14859,18 @@ static void handleAlertInLoop()
{
if (lastAlert.code > LAST_PROTO_STEP_7_ALERT)
{
- #ifdef WARNING
- *logofs << "Loop: WARNING! An unrecognized alert type '"
- << lastAlert.code << "' was requested.\n"
- << logofs_flush;
- #endif
+ nxwarn << "Loop: WARNING! An unrecognized alert type '"
+ << lastAlert.code << "' was requested.\n"
+ << std::flush;
cerr << "Warning" << ": An unrecognized alert type '"
<< lastAlert.code << "' was requested.\n";
}
- #ifdef WARNING
else
{
- *logofs << "Loop: WARNING! Ignoring obsolete alert type '"
- << lastAlert.code << "'.\n" << logofs_flush;
+ nxwarn << "Loop: WARNING! Ignoring obsolete alert type '"
+ << lastAlert.code << "'.\n" << std::flush;
}
- #endif
message = NULL;
type = NULL;
@@ -15976,10 +14883,8 @@ static void handleAlertInLoop()
if (replace == 1 && IsRunning(lastDialog))
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Killing the previous dialog with pid '"
- << lastDialog << "'.\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Killing the previous dialog with pid '"
+ << lastDialog << "'.\n" << std::flush;
//
// The client ignores the TERM signal
@@ -16010,28 +14915,22 @@ static void handleAlertInLoop()
if (IsFailed(lastDialog))
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Can't start the NX dialog process.\n"
- << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Can't start the NX dialog process.\n"
+ << std::flush;
SetNotRunning(lastDialog);
}
- #if defined(TEST) || defined(INFO)
else
{
- *logofs << "Loop: Dialog started with pid '"
- << lastDialog << "'.\n" << logofs_flush;
+ nxinfo << "Loop: Dialog started with pid '"
+ << lastDialog << "'.\n" << std::flush;
}
- #endif
}
- #if defined(TEST) || defined(INFO)
else
{
- *logofs << "Loop: No new dialog required for code '"
- << lastAlert.code << "'.\n" << logofs_flush;
+ nxinfo << "Loop: No new dialog required for code '"
+ << lastAlert.code << "'.\n" << std::flush;
}
- #endif
}
}
@@ -16046,10 +14945,8 @@ static void handleAlertInLoop()
static inline void handleSetAgentInLoop(int &setFDs, fd_set &readSet,
fd_set &writeSet, struct timeval &selectTs)
{
- #ifdef TEST
- *logofs << "Loop: Preparing the masks for the agent descriptors.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Preparing the masks for the agent descriptors.\n"
+ << std::flush;
agent -> saveChannelState();
@@ -16063,10 +14960,8 @@ static inline void handleSetAgentInLoop(int &setFDs, fd_set &readSet,
agent -> localCanRead() ||
agent -> proxyCanRead())
{
- #ifdef TEST
- *logofs << "Loop: Setting a null timeout with agent descriptors ready.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting a null timeout with agent descriptors ready.\n"
+ << std::flush;
//
// Force a null timeout so we'll bail out
@@ -16079,10 +14974,8 @@ static inline void handleSetAgentInLoop(int &setFDs, fd_set &readSet,
}
}
- #ifdef TEST
- *logofs << "Loop: Clearing the read and write agent descriptors.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Clearing the read and write agent descriptors.\n"
+ << std::flush;
agent -> clearReadMask(&readSet);
agent -> clearWriteMask(&writeSet);
@@ -16091,10 +14984,8 @@ static inline void handleSetAgentInLoop(int &setFDs, fd_set &readSet,
static inline void handleAgentInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet,
fd_set &writeSet, struct timeval &selectTs)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Setting proxy and local agent descriptors.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting proxy and local agent descriptors.\n"
+ << std::flush;
//
// Check if I/O is possible on the local
@@ -16110,57 +15001,47 @@ static inline void handleAgentInLoop(int &resultFDs, int &errorFDs, int &setFDs,
agent -> saveChannelState();
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Values were resultFDs " << resultFDs
- << " errorFDs " << errorFDs << " setFDs "
- << setFDs << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Values were resultFDs " << resultFDs
+ << " errorFDs " << errorFDs << " setFDs "
+ << setFDs << ".\n" << std::flush;
if (agent -> localCanRead() == 1)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Setting agent descriptor FD#" << agent ->
- getLocalFd() << " as ready to read.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting agent descriptor FD#" << agent ->
+ getLocalFd() << " as ready to read.\n"
+ << std::flush;
agent -> setLocalRead(&readSet, &resultFDs);
}
- #if defined(TEST) || defined(INFO)
if (agent -> proxyCanRead(&readSet) == 0 &&
agent -> proxyCanRead() == 1)
{
- *logofs << "Loop: WARNING! Can read from proxy FD#"
- << proxyFD << " but the descriptor "
- << "is not selected.\n" << logofs_flush;
+ nxinfo << "Loop: WARNING! Can read from proxy FD#"
+ << proxyFD << " but the descriptor "
+ << "is not selected.\n" << std::flush;
}
if (agent -> proxyCanRead(&readSet) == 1)
{
- *logofs << "Loop: Setting proxy descriptor FD#" << agent ->
- getProxyFd() << " as ready to read.\n"
- << logofs_flush;
+ nxinfo << "Loop: Setting proxy descriptor FD#" << agent ->
+ getProxyFd() << " as ready to read.\n"
+ << std::flush;
}
- #endif
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Values are now resultFDs " << resultFDs
- << " errorFDs " << errorFDs << " setFDs "
- << setFDs << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Values are now resultFDs " << resultFDs
+ << " errorFDs " << errorFDs << " setFDs "
+ << setFDs << ".\n" << std::flush;
}
}
static inline void handleAgentLateInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet,
fd_set &writeSet, struct timeval &selectTs)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Setting remote agent descriptors.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting remote agent descriptors.\n"
+ << std::flush;
//
// We reset the masks before calling our select.
@@ -16181,20 +15062,16 @@ static inline void handleAgentLateInLoop(int &resultFDs, int &errorFDs, int &set
agent -> saveChannelState();
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Values were resultFDs " << resultFDs
- << " errorFDs " << errorFDs << " setFDs "
- << setFDs << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Values were resultFDs " << resultFDs
+ << " errorFDs " << errorFDs << " setFDs "
+ << setFDs << ".\n" << std::flush;
if (agent -> remoteCanRead(agent ->
getSavedReadMask()) == 1)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Setting agent descriptor FD#" << agent ->
- getRemoteFd() << " as ready to read.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting agent descriptor FD#" << agent ->
+ getRemoteFd() << " as ready to read.\n"
+ << std::flush;
agent -> setRemoteRead(&readSet, &resultFDs);
}
@@ -16202,20 +15079,16 @@ static inline void handleAgentLateInLoop(int &resultFDs, int &errorFDs, int &set
if (agent -> remoteCanWrite(agent ->
getSavedWriteMask()) == 1)
{
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Setting agent descriptor FD#" << agent ->
- getRemoteFd() << " as ready to write.\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Setting agent descriptor FD#" << agent ->
+ getRemoteFd() << " as ready to write.\n"
+ << std::flush;
agent -> setRemoteWrite(&writeSet, &resultFDs);
}
- #if defined(TEST) || defined(INFO)
- *logofs << "Loop: Values are now resultFDs " << resultFDs
- << " errorFDs " << errorFDs << " setFDs "
- << setFDs << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Values are now resultFDs " << resultFDs
+ << " errorFDs " << errorFDs << " setFDs "
+ << setFDs << ".\n" << std::flush;
}
}
@@ -16335,10 +15208,8 @@ static inline void handleReadableInLoop(int &resultFDs, fd_set &readSet)
{
if (proxy -> handleNewConnection(type, newFD) < 0)
{
- #ifdef PANIC
- *logofs << "Loop: PANIC! Error creating new " << label
- << " connection.\n" << logofs_flush;
- #endif
+ nxfatal << "Loop: PANIC! Error creating new " << label
+ << " connection.\n" << std::flush;
cerr << "Error" << ": Error creating new " << label
<< " connection.\n";
@@ -16358,40 +15229,32 @@ static inline void handleReadableInLoop(int &resultFDs, fd_set &readSet)
// to read immediately.
//
- #ifdef TEST
- *logofs << "Loop: Trying to read immediately "
- << "from descriptor FD#" << newFD
- << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Trying to read immediately "
+ << "from descriptor FD#" << newFD
+ << ".\n" << std::flush;
FD_SET(newFD, &readSet);
resultFDs++;
}
- #ifdef TEST
else
{
- *logofs << "Loop: Nothing to read immediately "
- << "from descriptor FD#" << newFD
- << ".\n" << logofs_flush;
+ nxinfo << "Loop: Nothing to read immediately "
+ << "from descriptor FD#" << newFD
+ << ".\n" << std::flush;
}
- #endif
}
}
}
- #ifdef DEBUG
- *logofs << "Loop: Going to check the readable descriptors.\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Going to check the readable descriptors.\n"
+ << std::flush;
if (proxy -> handleRead(resultFDs, readSet) < 0)
{
- #ifdef TEST
- *logofs << "Loop: Failure reading from descriptors "
- << "for proxy FD#" << proxyFD << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Failure reading from descriptors "
+ << "for proxy FD#" << proxyFD << ".\n"
+ << std::flush;
HandleShutdown();
}
@@ -16399,18 +15262,14 @@ static inline void handleReadableInLoop(int &resultFDs, fd_set &readSet)
static inline void handleWritableInLoop(int &resultFDs, fd_set &writeSet)
{
- #ifdef DEBUG
- *logofs << "Loop: Going to check the writable descriptors.\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Going to check the writable descriptors.\n"
+ << std::flush;
if (resultFDs > 0 && proxy -> handleFlush(resultFDs, writeSet) < 0)
{
- #ifdef TEST
- *logofs << "Loop: Failure writing to descriptors "
- << "for proxy FD#" << proxyFD << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Failure writing to descriptors "
+ << "for proxy FD#" << proxyFD << ".\n"
+ << std::flush;
HandleShutdown();
}
@@ -16418,31 +15277,25 @@ static inline void handleWritableInLoop(int &resultFDs, fd_set &writeSet)
static inline void handleFlushInLoop()
{
- #ifdef DEBUG
- *logofs << "Loop: Going to flush any data to the proxy.\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Going to flush any data to the proxy.\n"
+ << std::flush;
if (agent == NULL || control ->
FlushPolicy == policy_immediate)
{
- #if defined(TEST) || defined(INFO)
if (usePolicy == -1 && control ->
ProxyMode == proxy_client)
{
- *logofs << "Loop: WARNING! Flushing the proxy link "
- << "on behalf of the agent.\n" << logofs_flush;
+ nxinfo << "Loop: WARNING! Flushing the proxy link "
+ << "on behalf of the agent.\n" << std::flush;
}
- #endif
if (proxy -> handleFlush() < 0)
{
- #ifdef TEST
- *logofs << "Loop: Failure flushing the proxy FD#"
- << proxyFD << ".\n" << logofs_flush;
- #endif
+ nxinfo << "Loop: Failure flushing the proxy FD#"
+ << proxyFD << ".\n" << std::flush;
HandleShutdown();
}
@@ -16451,36 +15304,30 @@ static inline void handleFlushInLoop()
static inline void handleRotateInLoop()
{
- #ifdef DEBUG
- *logofs << "Loop: Going to rotate channels "
- << "for proxy FD#" << proxyFD << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Going to rotate channels "
+ << "for proxy FD#" << proxyFD << ".\n"
+ << std::flush;
proxy -> handleRotate();
}
static inline void handleEventsInLoop()
{
- #ifdef DEBUG
- *logofs << "Loop: Going to check channel events "
- << "for proxy FD#" << proxyFD << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Going to check channel events "
+ << "for proxy FD#" << proxyFD << ".\n"
+ << std::flush;
if (proxy -> handleEvents() < 0)
{
- #ifdef TEST
- *logofs << "Loop: Failure handling channel events "
- << "for proxy FD#" << proxyFD << ".\n"
- << logofs_flush;
- #endif
+ nxinfo << "Loop: Failure handling channel events "
+ << "for proxy FD#" << proxyFD << ".\n"
+ << std::flush;
HandleShutdown();
}
}
-static void handleLogReopenInLoop(T_timestamp &logsTs, T_timestamp &nowTs)
+static void handleLogReopenInLoop(T_timestamp &lTs, T_timestamp &nTs)
{
//
// If need to limit the size of the
@@ -16490,14 +15337,12 @@ static void handleLogReopenInLoop(T_timestamp &logsTs, T_timestamp &nowTs)
#ifndef QUOTA
- if (diffTimestamp(logsTs, nowTs) > control -> FileSizeCheckTimeout)
+ if (diffTimestamp(lTs, nTs) > control -> FileSizeCheckTimeout)
#endif
{
- #ifdef DEBUG
- *logofs << "Loop: Checking size of log file '"
- << errorsFileName << "'.\n" << logofs_flush;
- #endif
+ nxdbg << "Loop: Checking size of log file '"
+ << errorsFileName << "'.\n" << std::flush;
#ifndef MIXED
@@ -16512,7 +15357,7 @@ static void handleLogReopenInLoop(T_timestamp &logsTs, T_timestamp &nowTs)
// Reset to current timestamp.
//
- logsTs = nowTs;
+ lTs = nTs;
}
}
@@ -16543,11 +15388,9 @@ static void handleSetListenersInLoop(fd_set &readSet, int &setFDs)
setFDs = tcpFD + 1;
}
- #ifdef DEBUG
- *logofs << "Loop: Selected listener tcpFD " << tcpFD
- << " with setFDs " << setFDs << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Selected listener tcpFD " << tcpFD
+ << " with setFDs " << setFDs << ".\n"
+ << std::flush;
}
if (useUnixSocket == 1)
@@ -16559,11 +15402,9 @@ static void handleSetListenersInLoop(fd_set &readSet, int &setFDs)
setFDs = unixFD + 1;
}
- #ifdef DEBUG
- *logofs << "Loop: Selected listener unixFD " << unixFD
- << " with setFDs " << setFDs << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Selected listener unixFD " << unixFD
+ << " with setFDs " << setFDs << ".\n"
+ << std::flush;
}
if (useCupsSocket == 1)
@@ -16575,11 +15416,9 @@ static void handleSetListenersInLoop(fd_set &readSet, int &setFDs)
setFDs = cupsFD + 1;
}
- #ifdef DEBUG
- *logofs << "Loop: Selected listener cupsFD " << cupsFD
- << " with setFDs " << setFDs << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Selected listener cupsFD " << cupsFD
+ << " with setFDs " << setFDs << ".\n"
+ << std::flush;
}
if (useAuxSocket == 1)
@@ -16591,11 +15430,9 @@ static void handleSetListenersInLoop(fd_set &readSet, int &setFDs)
setFDs = auxFD + 1;
}
- #ifdef DEBUG
- *logofs << "Loop: Selected listener auxFD " << auxFD
- << " with setFDs " << setFDs << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Selected listener auxFD " << auxFD
+ << " with setFDs " << setFDs << ".\n"
+ << std::flush;
}
if (useSmbSocket == 1)
@@ -16607,11 +15444,9 @@ static void handleSetListenersInLoop(fd_set &readSet, int &setFDs)
setFDs = smbFD + 1;
}
- #ifdef DEBUG
- *logofs << "Loop: Selected listener smbFD " << smbFD
- << " with setFDs " << setFDs << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Selected listener smbFD " << smbFD
+ << " with setFDs " << setFDs << ".\n"
+ << std::flush;
}
if (useMediaSocket == 1)
@@ -16623,11 +15458,9 @@ static void handleSetListenersInLoop(fd_set &readSet, int &setFDs)
setFDs = mediaFD + 1;
}
- #ifdef DEBUG
- *logofs << "Loop: Selected listener mediaFD " << mediaFD
- << " with setFDs " << setFDs << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Selected listener mediaFD " << mediaFD
+ << " with setFDs " << setFDs << ".\n"
+ << std::flush;
}
if (useHttpSocket == 1)
@@ -16639,11 +15472,9 @@ static void handleSetListenersInLoop(fd_set &readSet, int &setFDs)
setFDs = httpFD + 1;
}
- #ifdef DEBUG
- *logofs << "Loop: Selected listener httpFD " << httpFD
- << " with setFDs " << setFDs << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Selected listener httpFD " << httpFD
+ << " with setFDs " << setFDs << ".\n"
+ << std::flush;
}
}
else
@@ -16657,11 +15488,9 @@ static void handleSetListenersInLoop(fd_set &readSet, int &setFDs)
setFDs = fontFD + 1;
}
- #ifdef DEBUG
- *logofs << "Loop: Selected listener fontFD " << fontFD
- << " with setFDs " << setFDs << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Selected listener fontFD " << fontFD
+ << " with setFDs " << setFDs << ".\n"
+ << std::flush;
}
}
@@ -16674,10 +15503,8 @@ static void handleSetListenersInLoop(fd_set &readSet, int &setFDs)
setFDs = slaveFD + 1;
}
- #ifdef DEBUG
- *logofs << "Loop: Selected listener slaveFD " << slaveFD
- << " with setFDs " << setFDs << ".\n"
- << logofs_flush;
- #endif
+ nxdbg << "Loop: Selected listener slaveFD " << slaveFD
+ << " with setFDs " << setFDs << ".\n"
+ << std::flush;
}
}
diff --git a/nxcomp/MD5.c b/nxcomp/src/MD5.c
index e49d3cf58..7255ca5c0 100644
--- a/nxcomp/MD5.c
+++ b/nxcomp/src/MD5.c
@@ -51,6 +51,10 @@
1999-05-03 lpd Original version.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "MD5.h"
#include <string.h>
diff --git a/nxcomp/src/Makefile.am b/nxcomp/src/Makefile.am
new file mode 100644
index 000000000..682ddbaca
--- /dev/null
+++ b/nxcomp/src/Makefile.am
@@ -0,0 +1,153 @@
+NULL =
+
+lib_LTLIBRARIES = libXcomp.la
+
+libXcomp_la_SOURCES = \
+ ActionCache.cpp \
+ Agent.cpp \
+ Alpha.cpp \
+ Auth.cpp \
+ Bitmap.cpp \
+ BlockCache.cpp \
+ BlockCacheSet.cpp \
+ ChangeGC.cpp \
+ ChangeProperty.cpp \
+ ChannelCache.cpp \
+ Channel.cpp \
+ ChannelEndPoint.cpp \
+ CharCache.cpp \
+ Children.cpp \
+ ClearArea.cpp \
+ ClientCache.cpp \
+ ClientChannel.cpp \
+ ClientProxy.cpp \
+ ClientReadBuffer.cpp \
+ ClientStore.cpp \
+ Colormap.cpp \
+ ConfigureWindow.cpp \
+ Control.cpp \
+ CopyArea.cpp \
+ CreateGC.cpp \
+ CreatePixmap.cpp \
+ DecodeBuffer.cpp \
+ EncodeBuffer.cpp \
+ FillPoly.cpp \
+ Fork.cpp \
+ GenericChannel.cpp \
+ GenericReadBuffer.cpp \
+ GenericReply.cpp \
+ GenericRequest.cpp \
+ GetImage.cpp \
+ GetImageReply.cpp \
+ GetProperty.cpp \
+ GetPropertyReply.cpp \
+ ImageText16.cpp \
+ ImageText8.cpp \
+ IntCache.cpp \
+ InternAtom.cpp \
+ Jpeg.cpp \
+ Keeper.cpp \
+ List.cpp \
+ ListFontsReply.cpp \
+ Loop.cpp \
+ Message.cpp \
+ MD5.c \
+ Misc.cpp \
+ OpcodeStore.cpp \
+ Pack.c \
+ Pgn.cpp \
+ Pipe.cpp \
+ PolyArc.cpp \
+ PolyFillArc.cpp \
+ PolyFillRectangle.cpp \
+ PolyLine.cpp \
+ PolyPoint.cpp \
+ PolySegment.cpp \
+ PolyText16.cpp \
+ PolyText8.cpp \
+ Proxy.cpp \
+ ProxyReadBuffer.cpp \
+ PutImage.cpp \
+ PutPackedImage.cpp \
+ QueryFontReply.cpp \
+ ReadBuffer.cpp \
+ RenderAddGlyphs.cpp \
+ RenderChangePicture.cpp \
+ RenderComposite.cpp \
+ RenderCompositeGlyphs.cpp \
+ RenderCreateGlyphSet.cpp \
+ RenderCreatePicture.cpp \
+ RenderExtension.cpp \
+ RenderFillRectangles.cpp \
+ RenderFreeGlyphSet.cpp \
+ RenderFreePicture.cpp \
+ RenderGenericRequest.cpp \
+ RenderPictureClip.cpp \
+ RenderPictureFilter.cpp \
+ RenderPictureTransform.cpp \
+ RenderTrapezoids.cpp \
+ RenderTriangles.cpp \
+ Rgb.cpp \
+ Rle.cpp \
+ SendEvent.cpp \
+ SequenceQueue.cpp \
+ ServerCache.cpp \
+ ServerChannel.cpp \
+ ServerProxy.cpp \
+ ServerReadBuffer.cpp \
+ ServerStore.cpp \
+ SetClipRectangles.cpp \
+ SetUnpackAlpha.cpp \
+ SetUnpackColormap.cpp \
+ SetUnpackGeometry.cpp \
+ ShapeExtension.cpp \
+ Socket.cpp \
+ Split.cpp \
+ StaticCompressor.cpp \
+ Statistics.cpp \
+ Timestamp.cpp \
+ TranslateCoords.cpp \
+ Transport.cpp \
+ Unpack.cpp \
+ Vars.c \
+ Version.c \
+ WriteBuffer.cpp \
+ XidCache.cpp \
+ Z.cpp \
+ Log.cpp \
+ $(NULL)
+
+libXcomp_la_LIBADD = \
+ @JPEG_LIBS@ \
+ @PNG_LIBS@ \
+ @Z_LIBS@ \
+ @PTHREAD_LIBS@ \
+ $(NULL)
+
+AM_CXXFLAGS = \
+ $(BASE_CXXFLAGS) \
+ $(JPEG_CFLAGS) \
+ $(PNG_CFLAGS) \
+ $(Z_CFLAGS) \
+ $(PTHREAD_CFLAGS) \
+ $(NULL)
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/include \
+ $(NULL)
+
+libXcomp_la_LDFLAGS = \
+ -version-number @LT_COMP_VERSION@ \
+ -no-undefined \
+ $(PTHREAD_LDFLAGS) \
+ $(NULL)
+
+libXcompincludedir = $(includedir)/nx
+libXcompinclude_HEADERS = \
+ $(top_srcdir)/include/MD5.h \
+ $(top_srcdir)/include/NX.h \
+ $(top_srcdir)/include/NXalert.h \
+ $(top_srcdir)/include/NXpack.h \
+ $(top_srcdir)/include/NXproto.h \
+ $(top_srcdir)/include/NXvars.h \
+ $(NULL)
diff --git a/nxcomp/Message.cpp b/nxcomp/src/Message.cpp
index 72d4fff3d..b75d90c24 100644
--- a/nxcomp/Message.cpp
+++ b/nxcomp/src/Message.cpp
@@ -1,23 +1,35 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
-#include <stdio.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <cstdio>
#include <unistd.h>
-#include <string.h>
+#include <cstring>
#include <algorithm>
@@ -113,20 +125,6 @@ MessageStore::MessageStore(StaticCompressor *compressor)
lastAction = is_discarded;
//
- // This is used only for compatibility
- // with older proxies.
- //
-
- if (control -> isProtoStep7() == 1)
- {
- lastResize = -1;
- }
- else
- {
- lastResize = 0;
- }
-
- //
// Private members.
//
diff --git a/nxcomp/Message.h b/nxcomp/src/Message.h
index dcfff7cb6..30883f101 100644
--- a/nxcomp/Message.h
+++ b/nxcomp/src/Message.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Message_H
@@ -30,9 +38,6 @@
#include "ActionCache.h"
-#include "ActionCacheCompat.h"
-#include "PositionCacheCompat.h"
-
#include "StaticCompressor.h"
//
@@ -346,16 +351,6 @@ class MessageStore
ActionCache lastActionCache;
//
- // Used in old protocol versions.
- //
-
- ActionCacheCompat lastActionCacheCompat;
-
- PositionCacheCompat lastAddedCacheCompat;
- PositionCacheCompat lastHitCacheCompat;
- PositionCacheCompat lastRemovedCacheCompat;
-
- //
// Position in cache where next insertion
// is going to take place.
//
@@ -363,14 +358,6 @@ class MessageStore
short int lastRated;
//
- // Size of data part of last split message
- // once compressed. This is used only for
- // compatibility with older proxies.
- //
-
- int lastResize;
-
- //
// Constructors and destructors.
//
diff --git a/nxcomp/Misc.cpp b/nxcomp/src/Misc.cpp
index 2c72259e3..7e468f1e2 100644
--- a/nxcomp/Misc.cpp
+++ b/nxcomp/src/Misc.cpp
@@ -1,25 +1,37 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <cstdio>
+#include <cctype>
+#include <cstdlib>
#include <unistd.h>
-#include <signal.h>
+#include <csignal>
#include <errno.h>
#include <string.h>
@@ -42,6 +54,14 @@
#undef DEBUG
//
+// By default nxproxy binds to all network interfaces, setting
+// DEFAULT_LOOPBACK_BIND to 1 enables binding to the loopback
+// device only.
+//
+
+const int DEFAULT_LOOPBACK_BIND = 0;
+
+//
// TCP port offset applied to any NX port specification.
//
@@ -112,6 +132,20 @@ static const char UsageInfo[] =
\n\
-v Print version information.\n\
\n\
+ -d <n> Set log level (0=FATAL, 1=ERROR, 2=WARNING, 3=INFO,\n\
+ 4=DEBUG). Default is 0.\n\
+\n\
+ -o <file> Name of the logfile. Default is stderr.\n\
+\n\
+ -f <string> Specify log format. The characters in <string> define\n\
+ how the loglines are formatted. The following characters\n\
+ are supported, default is 0:\n\
+ 0 only the plain text without any additions\n\
+ u include time\n\
+ l include loglevel\n\
+ T include thread ids\n\
+ L include the source code location of the log\n\
+\n\
host:port Put at the end, specifies the host and port of the\n\
listening proxy.\n\
\n\
@@ -137,13 +171,15 @@ static const char UsageInfo[] =
\n\
listen=n Local port used for accepting the proxy connection.\n\
\n\
+ loopback=b Bind to the loopback device only.\n\
+\n\
accept=s Name or IP of host that can connect to the proxy.\n\
\n\
connect=s Name or IP of host that the proxy will connect to.\n\
\n\
port=n Remote port used for the connection.\n\
\n\
- retry=n Number of connection atempts.\n\
+ retry=n Number of connection attempts.\n\
\n\
root=s The root directory for the session. Usually is the\n\
C-* or S-* in the .nx directory in the user's home,\n\
@@ -155,8 +191,8 @@ static const char UsageInfo[] =
errors=s Name of the log file used by the proxy. The default\n\
is the name 'errors' in the session directory.\n\
\n\
- stats=s Name of the file where are written the proxy stat-\n\
- istics. The default is a file 'stats' in the session\n\
+ stats=s Name of the file where the proxy statistics are writ-\n\
+ ten to. The default is a file 'stats' in the session\n\
directory. The proxy replaces the data in the file\n\
whenever it receives a SIGUSR1 or SIGUSR2 signal:\n\
\n\
@@ -204,8 +240,8 @@ static const char UsageInfo[] =
\n\
limit=n Specify a bitrate limit allowed for this session.\n\
\n\
- memory=n Trigger memory optimizations used to keep small the\n\
- size of X buffers. This is useful on embedded plat-\n\
+ memory=n Trigger memory optimizations used to keep the size\n\
+ of X buffers small. This is useful on embedded plat-\n\
forms, or where memory is scarce.\n\
\n\
cache=n Size of the in-memory X message cache. Setting the\n\
@@ -292,10 +328,11 @@ geometry=s\n\
resize=b\n\
fullscreen=b\n\
keyboard=s\n\
-clipboard=n\n\
+clipboard=s\n\
streaming=n\n\
backingstore=n\n\
composite=n\n\
+xinerama=n\n\
shmem=b\n\
shpix=b\n\
kbtype=s\n\
@@ -305,7 +342,11 @@ shadowuid=n\n\
shadowmode=s\n\
defer=n\n\
tile=s\n\
-menu=n These options are interpreted by the NX agent. They\n\
+menu=n\n\
+sleep=n\n\
+tolerancechecks=s\n\
+keyconv=s\n\
+ These options are interpreted by the NX agent. They\n\
are ignored by the proxy.\n\
\n\
Environment:\n\
@@ -325,8 +366,7 @@ menu=n These options are interpreted by the NX agent. They\n\
NX_HOME The NX user's home directory. If NX_ROOT is not set\n\
or invalid, the user's NX directory is created here.\n\
\n\
- NX_TEMP The directory where the X11 Unix Domain Sockets and\n\
- all temporary files are to be created.\n\
+ NX_TEMP The directory where all temporary files are to be created.\n\
\n\
NX_CLIENT The full path to the nxclient executable. If the va-\n\
riable is not set, the nxclient executable will be\n\
@@ -335,6 +375,15 @@ menu=n These options are interpreted by the NX agent. They\n\
Mac where nxclient is located in a different direct-\n\
ory compared to the other programs, to make easier\n\
for the user to execute the program from the shell.\n\
+ The nxclient executable will be used for displaying\n\
+ the menu and request windows to the user.\n\
+\n\
+ NX_SLAVE_CMD The full path to the slave channel handler. When the\n\
+ slave channel is enabled, the agent will listen on a\n\
+ port and forward the connection to the NX_SLAVE_CMD\n\
+ program. This can be used to implement agent/proxy\n\
+ communication for applications such as serial port and\n\
+ USB forwarding.\n\
\n\
Shell environment:\n\
\n\
@@ -345,7 +394,7 @@ menu=n These options are interpreted by the NX agent. They\n\
ory is not set, null or invalid.\n\
\n\
PATH The path where all executables are searched, except\n\
- nxclient. If NX_CLIENT is not set, also the client\n\
+ nxclient. If NX_CLIENT is not set, also the nxclient\n\
executable is searched in the system path.\n\
\n\
LD_LIBRARY_PATH\n\
@@ -371,18 +420,26 @@ const char *GetUsageInfo()
static const char CopyrightInfo[] =
"\
-Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/.\n\
-\n\
-NXCOMP, NX protocol compression and NX extensions to this software \n\
-are copyright of NoMachine. Redistribution and use of the present\n\
-software is allowed according to terms specified in the file LICENSE\n\
-which comes in the source distribution.\n\
+Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com)\n\
+Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de>\n\
+Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de>\n\
+Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de>\n\
+Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>\n\
+Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com)\n\
\n\
-Check http://www.nomachine.com/licensing.html for applicability.\n\
+NXCOMP, NX protocol compression and NX extensions to this software\n\
+are copyright of the aforementioned persons and companies.\n\
\n\
-NX and NoMachine are trademarks of NoMachine S.r.l.\n\
+Redistribution and use of the present software is allowed according\n\
+to terms specified in the file LICENSE.nxcomp which comes in the\n\
+source distribution.\n\
\n\
All rights reserved.\n\
+\n\
+NOTE: This software has received contributions from various other\n\
+contributors, only the core maintainers and supporters are listed as\n\
+copyright holders. Please contact us, if you feel you should be listed\n\
+as copyright holder, as well.\n\
";
const char *GetCopyrightInfo()
diff --git a/nxcomp/Misc.h b/nxcomp/src/Misc.h
index 200831757..7808c34c2 100644
--- a/nxcomp/Misc.h
+++ b/nxcomp/src/Misc.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Misc_H
@@ -21,8 +29,8 @@
#include <iostream>
#include <fstream>
-#include <errno.h>
-#include <string.h>
+#include <cerrno>
+#include <cstring>
#ifdef __sun
@@ -46,6 +54,9 @@ using namespace std;
#define EGET() (errno)
#define ESTR() strerror(errno)
+// a free() macro that clears the ptr after free
+#define SAFE_FREE(ptr) do { free(ptr); ptr = NULL; } while (0)
+
//
// TCP port offset applied to NX port specification.
//
@@ -90,6 +101,14 @@ extern const int DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET;
extern const int DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET;
//
+// NX proxy binds to all network interfaces by default
+// With the -loopback parameter, you can switch
+// over to binding to the loopback device only.
+//
+
+extern const int DEFAULT_LOOPBACK_BIND;
+
+//
// Return strings containing various info.
//
@@ -132,6 +151,7 @@ void HandleShutdown() __attribute__((noreturn));
extern "C"
{
void HandleCleanup(int code = 0) __attribute__((noreturn));
+ void HandleCleanupForReconnect();
}
//
diff --git a/nxcomp/NXmitshm.h b/nxcomp/src/NXmitshm.h
index aa79ec8ae..939d488fb 100644
--- a/nxcomp/NXmitshm.h
+++ b/nxcomp/src/NXmitshm.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef NXmitshm_H
diff --git a/nxcomp/NXrender.h b/nxcomp/src/NXrender.h
index bc359f273..280715833 100644
--- a/nxcomp/NXrender.h
+++ b/nxcomp/src/NXrender.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef NXrender_H
diff --git a/nxcomp/OpcodeCache.h b/nxcomp/src/OpcodeCache.h
index 529f8eee1..e07a1b997 100644
--- a/nxcomp/OpcodeCache.h
+++ b/nxcomp/src/OpcodeCache.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef OpcodeCache_H
diff --git a/nxcomp/OpcodeStore.cpp b/nxcomp/src/OpcodeStore.cpp
index 909744821..21b919c8a 100644
--- a/nxcomp/OpcodeStore.cpp
+++ b/nxcomp/src/OpcodeStore.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "OpcodeStore.h"
OpcodeStore::OpcodeStore()
diff --git a/nxcomp/OpcodeStore.h b/nxcomp/src/OpcodeStore.h
index f6626dfef..d041ed4b8 100644
--- a/nxcomp/OpcodeStore.h
+++ b/nxcomp/src/OpcodeStore.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef OpcodeStore_H
diff --git a/nxcomp/Pack.c b/nxcomp/src/Pack.c
index 59a54cfbf..97fb93b5f 100644
--- a/nxcomp/Pack.c
+++ b/nxcomp/src/Pack.c
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#define PANIC
diff --git a/nxcomp/Pgn.cpp b/nxcomp/src/Pgn.cpp
index a68373441..649227f52 100644
--- a/nxcomp/Pgn.cpp
+++ b/nxcomp/src/Pgn.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
//
// This file obviously supports PNG
// decompression. It was renamed to
@@ -23,6 +35,9 @@
#include <X11/Xmd.h>
+#ifdef ANDROID
+#include <strings.h>
+#endif
#include <unistd.h>
#include <stdio.h>
#include <png.h>
@@ -414,7 +429,7 @@ int DecompressPng16(unsigned char *compressedData, int compressedLen,
png_read_info(pngPtr, infoPtr);
- if (infoPtr -> color_type == PNG_COLOR_TYPE_PALETTE)
+ if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE)
{
png_set_expand(pngPtr);
}
@@ -565,7 +580,7 @@ int DecompressPng24(unsigned char *compressedData, int compressedLen,
png_read_info( pngPtr, infoPtr ) ;
- if (infoPtr -> color_type == PNG_COLOR_TYPE_PALETTE)
+ if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE)
{
png_set_expand(pngPtr);
}
@@ -709,7 +724,7 @@ int DecompressPng32(unsigned char *compressedData, int compressedLen,
png_read_info(pngPtr, infoPtr) ;
- if (infoPtr -> color_type == PNG_COLOR_TYPE_PALETTE)
+ if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE)
{
png_set_expand(pngPtr);
}
diff --git a/nxcomp/Pgn.h b/nxcomp/src/Pgn.h
index ddf9b75d1..e5ea36715 100644
--- a/nxcomp/Pgn.h
+++ b/nxcomp/src/Pgn.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Pgn_H
diff --git a/nxcomp/Pipe.cpp b/nxcomp/src/Pipe.cpp
index 7238d0c73..228c556ae 100644
--- a/nxcomp/Pipe.cpp
+++ b/nxcomp/src/Pipe.cpp
@@ -1,26 +1,39 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <grp.h>
#include "Pipe.h"
#include "Misc.h"
@@ -190,7 +203,7 @@ FILE *Popen(char * const parameters[], const char *type)
if (pipe(pdes) < 0)
{
- free(cur);
+ SAFE_FREE(cur);
return NULL;
}
@@ -224,7 +237,7 @@ FILE *Popen(char * const parameters[], const char *type)
close(pdes[0]);
close(pdes[1]);
- free(cur);
+ SAFE_FREE(cur);
return NULL;
}
@@ -234,8 +247,16 @@ FILE *Popen(char * const parameters[], const char *type)
// Child.
//
- setgid(getgid());
- setuid(getuid());
+ struct passwd *pwent = getpwuid(getuid());
+ if (pwent) initgroups(pwent->pw_name,getgid());
+ if (setgid(getgid()) == -1)
+ {
+ _exit(127);
+ }
+ if (setuid(getuid()) == -1)
+ {
+ _exit(127);
+ }
if (*type == 'r')
{
@@ -399,7 +420,7 @@ int Pclose(FILE *iop)
last -> next = cur -> next;
}
- free(cur);
+ SAFE_FREE(cur);
//
// Child has finished and we called the
diff --git a/nxcomp/Pipe.h b/nxcomp/src/Pipe.h
index b4563a967..fd1061d30 100644
--- a/nxcomp/Pipe.h
+++ b/nxcomp/src/Pipe.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
//
diff --git a/nxcomp/PolyArc.cpp b/nxcomp/src/PolyArc.cpp
index e572fa454..42dbb265d 100644
--- a/nxcomp/PolyArc.cpp
+++ b/nxcomp/src/PolyArc.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "PolyArc.h"
#include "ClientCache.h"
diff --git a/nxcomp/PolyArc.h b/nxcomp/src/PolyArc.h
index 50d2fd9a9..d744d6a10 100644
--- a/nxcomp/PolyArc.h
+++ b/nxcomp/src/PolyArc.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef PolyArc_H
diff --git a/nxcomp/PolyFillArc.cpp b/nxcomp/src/PolyFillArc.cpp
index 2733eb62a..35125f0d3 100644
--- a/nxcomp/PolyFillArc.cpp
+++ b/nxcomp/src/PolyFillArc.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "PolyFillArc.h"
#include "ClientCache.h"
diff --git a/nxcomp/PolyFillArc.h b/nxcomp/src/PolyFillArc.h
index 721f5ac97..a4eff5b48 100644
--- a/nxcomp/PolyFillArc.h
+++ b/nxcomp/src/PolyFillArc.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef PolyFillArc_H
diff --git a/nxcomp/PolyFillRectangle.cpp b/nxcomp/src/PolyFillRectangle.cpp
index e1e6b7876..95694e582 100644
--- a/nxcomp/PolyFillRectangle.cpp
+++ b/nxcomp/src/PolyFillRectangle.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "PolyFillRectangle.h"
#include "ClientCache.h"
diff --git a/nxcomp/PolyFillRectangle.h b/nxcomp/src/PolyFillRectangle.h
index bf94c4818..7ebb9270d 100644
--- a/nxcomp/PolyFillRectangle.h
+++ b/nxcomp/src/PolyFillRectangle.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef PolyFillRectangle_H
diff --git a/nxcomp/PolyLine.cpp b/nxcomp/src/PolyLine.cpp
index 4d285e0b1..1b12bbe98 100644
--- a/nxcomp/PolyLine.cpp
+++ b/nxcomp/src/PolyLine.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "PolyLine.h"
#include "ClientCache.h"
@@ -93,10 +105,8 @@ void PolyLineStore::dumpIdentity(const Message *message) const
void PolyLineStore::identityChecksum(const Message *message, const unsigned char *buffer,
unsigned int size, int bigEndian) const
{
- if (control -> isProtoStep8() == 1)
- {
- md5_append(md5_state_, buffer + 1, 1);
- }
+ // Since ProtoStep8 (#issue 108)
+ md5_append(md5_state_, buffer + 1, 1);
}
void PolyLineStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message,
@@ -108,11 +118,6 @@ void PolyLineStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *me
ClientCache *clientCache = (ClientCache *) channelCache;
- if (control -> isProtoStep8() == 0)
- {
- encodeBuffer.encodeBoolValue((unsigned int) polyLine -> mode);
- }
-
#ifdef TEST
*logofs << name() << ": Encoding value " << polyLine -> drawable
<< " as drawable field.\n" << logofs_flush;
@@ -141,13 +146,6 @@ void PolyLineStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *me
unsigned int value;
- if (control -> isProtoStep8() == 0)
- {
- decodeBuffer.decodeBoolValue(value);
-
- polyLine -> mode = value;
- }
-
decodeBuffer.decodeXidValue(value, clientCache -> drawableCache);
polyLine -> drawable = value;
diff --git a/nxcomp/PolyLine.h b/nxcomp/src/PolyLine.h
index 39447e659..66fa5df1a 100644
--- a/nxcomp/PolyLine.h
+++ b/nxcomp/src/PolyLine.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef PolyLine_H
diff --git a/nxcomp/PolyPoint.cpp b/nxcomp/src/PolyPoint.cpp
index 847300f78..70151cc0d 100644
--- a/nxcomp/PolyPoint.cpp
+++ b/nxcomp/src/PolyPoint.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "PolyPoint.h"
#include "ClientCache.h"
@@ -93,10 +105,8 @@ void PolyPointStore::dumpIdentity(const Message *message) const
void PolyPointStore::identityChecksum(const Message *message, const unsigned char *buffer,
unsigned int size, int bigEndian) const
{
- if (control -> isProtoStep8() == 1)
- {
- md5_append(md5_state_, buffer + 1, 1);
- }
+ // Since ProtoStep8 (#issue 108)
+ md5_append(md5_state_, buffer + 1, 1);
}
void PolyPointStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message,
@@ -108,11 +118,6 @@ void PolyPointStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *m
ClientCache *clientCache = (ClientCache *) channelCache;
- if (control -> isProtoStep8() == 0)
- {
- encodeBuffer.encodeBoolValue((unsigned int) polyPoint -> mode);
- }
-
#ifdef TEST
*logofs << name() << ": Encoding value " << polyPoint -> drawable
<< " as drawable field.\n" << logofs_flush;
@@ -141,13 +146,6 @@ void PolyPointStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *m
unsigned int value;
- if (control -> isProtoStep8() == 0)
- {
- decodeBuffer.decodeBoolValue(value);
-
- polyPoint -> mode = value;
- }
-
decodeBuffer.decodeXidValue(value, clientCache -> drawableCache);
polyPoint -> drawable = value;
diff --git a/nxcomp/PolyPoint.h b/nxcomp/src/PolyPoint.h
index e090ff9fa..b8ea183bf 100644
--- a/nxcomp/PolyPoint.h
+++ b/nxcomp/src/PolyPoint.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef PolyPoint_H
diff --git a/nxcomp/PolySegment.cpp b/nxcomp/src/PolySegment.cpp
index e9259d958..aa2d4efe3 100644
--- a/nxcomp/PolySegment.cpp
+++ b/nxcomp/src/PolySegment.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "PolySegment.h"
#include "ClientCache.h"
diff --git a/nxcomp/PolySegment.h b/nxcomp/src/PolySegment.h
index a74865827..53fd42c60 100644
--- a/nxcomp/PolySegment.h
+++ b/nxcomp/src/PolySegment.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef PolySegment_H
diff --git a/nxcomp/PolyText16.cpp b/nxcomp/src/PolyText16.cpp
index d90b093ec..32be45482 100644
--- a/nxcomp/PolyText16.cpp
+++ b/nxcomp/src/PolyText16.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "PolyText16.h"
#include "ClientCache.h"
diff --git a/nxcomp/PolyText16.h b/nxcomp/src/PolyText16.h
index cda6cceed..805e1fa04 100644
--- a/nxcomp/PolyText16.h
+++ b/nxcomp/src/PolyText16.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef PolyText16_H
diff --git a/nxcomp/PolyText8.cpp b/nxcomp/src/PolyText8.cpp
index 15752721d..61fef5a4f 100644
--- a/nxcomp/PolyText8.cpp
+++ b/nxcomp/src/PolyText8.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "PolyText8.h"
#include "ClientCache.h"
diff --git a/nxcomp/PolyText8.h b/nxcomp/src/PolyText8.h
index eac5aab7c..3d5ff533a 100644
--- a/nxcomp/PolyText8.h
+++ b/nxcomp/src/PolyText8.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef PolyText8_H
diff --git a/nxcomp/Proxy.cpp b/nxcomp/src/Proxy.cpp
index 3b4df7eb6..437296f60 100644
--- a/nxcomp/Proxy.cpp
+++ b/nxcomp/src/Proxy.cpp
@@ -1,25 +1,45 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
-#include <stdio.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <cstdio>
#include <unistd.h>
-#include <stdlib.h>
+#include <cstdlib>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <signal.h>
+
+#ifdef ANDROID
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
+#endif
#include "Misc.h"
@@ -27,22 +47,10 @@
#include <netinet/in_systm.h>
#endif
-#ifndef __CYGWIN32__
-#include <sys/un.h>
-#endif
-
+#ifndef ANDROID
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
-
-#if defined(__EMX__ ) || defined(__CYGWIN32__)
-
-struct sockaddr_un
-{
- u_short sun_family;
- char sun_path[108];
-};
-
#endif
#include "NXalert.h"
@@ -57,6 +65,7 @@ struct sockaddr_un
#include "ClientChannel.h"
#include "ServerChannel.h"
#include "GenericChannel.h"
+#include "ChannelEndPoint.h"
//
// We need to adjust some values related
@@ -75,6 +84,8 @@ struct sockaddr_un
extern void CleanupListeners();
+extern int HandleChild(int);
+
//
// Default size of string buffers.
//
@@ -148,6 +159,7 @@ Proxy::Proxy(int fd)
fdMap_[channelId] = nothing;
channelMap_[channelId] = nothing;
+ slavePidMap_[channelId] = nothing;
}
inputChannel_ = nothing;
@@ -237,22 +249,6 @@ Proxy::Proxy(int fd)
clientStore_ = new ClientStore(compressor_);
serverStore_ = new ServerStore(compressor_);
- //
- // Older proxies will refuse to store
- // messages bigger than 262144 bytes.
- //
-
- if (control -> isProtoStep7() == 0)
- {
- #ifdef TEST
- *logofs << "Proxy: WARNING! Limiting the maximum "
- << "message size to " << 262144 << ".\n"
- << logofs_flush;
- #endif
-
- control -> MaximumMessageSize = 262144;
- }
-
clientCache_ = new ClientCache();
serverCache_ = new ServerCache();
@@ -295,6 +291,66 @@ Proxy::~Proxy()
}
}
+ //
+ // Kill all active slave channel children, and
+ // give them 5 seconds to exit nicely.
+
+ #ifdef DEBUG
+ *logofs << "Proxy: Killing active slaves" << endl;
+ #endif
+
+ int slave_count = 999;
+ int loop_count = 0;
+
+ while(slave_count > 0 && loop_count < 50)
+ {
+ slave_count = 0;
+
+ for (int channelId = 0; channelId<CONNECTIONS_LIMIT; channelId++)
+ {
+ int pid = slavePidMap_[channelId];
+
+ if (pid > 1) {
+ slave_count++;
+
+ #ifdef DEBUG
+ *logofs << "Proxy: Active slave with pid " << pid << logofs_flush;
+ #endif
+
+ if ( loop_count == 0 )
+ {
+ #ifdef DEBUG
+ *logofs << "Proxy: Sending SIGTERM to " << pid << logofs_flush;
+ #endif
+ kill(pid, SIGTERM);
+ }
+ else if ( loop_count == 25 )
+ {
+ #ifdef DEBUG
+ *logofs << "Proxy: Sending SIGKILL to " << pid << logofs_flush;
+ #endif
+ kill(pid, SIGKILL);
+ }
+
+ if (HandleChild(pid))
+ {
+ #ifdef DEBUG
+ *logofs << "Proxy: Slave " << pid << " terminated" << logofs_flush;
+ #endif
+ slavePidMap_[channelId] = nothing;
+ }
+ }
+ }
+
+ if ( slave_count > 0 )
+ {
+ cerr << "Proxy: Error: Failed to kill all slave channel processes. " << slave_count << " processes still remaining." << endl;
+ }
+
+ usleep(200000);
+ loop_count++;
+ }
+
delete transport_;
delete compressor_;
@@ -354,8 +410,8 @@ int Proxy::setReadDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax)
#ifdef TEST
*logofs << "Proxy: Initial timeout is " << tsMax.tv_sec
- << " S and " << (double) tsMax.tv_usec /
- 1000 << " Ms with congestion "
+ << " s and " << (double) tsMax.tv_usec /
+ 1000 << " ms with congestion "
<< statistics -> getCongestionInFrame()
<< ".\n" << logofs_flush;
#endif
@@ -366,8 +422,8 @@ int Proxy::setReadDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax)
#ifdef TEST
*logofs << "Proxy: Initial timeout is " << tsMax.tv_sec
- << " S and " << (double) tsMax.tv_usec /
- 1000 << " Ms.\n" << logofs_flush;
+ << " s and " << (double) tsMax.tv_usec /
+ 1000 << " ms.\n" << logofs_flush;
#endif
}
@@ -393,12 +449,12 @@ int Proxy::setReadDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax)
{
*logofs << "Proxy: FLUSH! SPLIT! WARNING! Running with "
<< diffTimestamp(timeouts_.splitTs, getTimestamp())
- << " Ms elapsed since the last split.\n"
+ << " ms elapsed since the last split.\n"
<< logofs_flush;
}
*logofs << "Proxy: FLUSH! SPLIT! Requesting timeout of "
- << diffTs << " Ms as there are splits to send.\n"
+ << diffTs << " ms as there are splits to send.\n"
<< logofs_flush;
#endif
@@ -469,12 +525,12 @@ int Proxy::setReadDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax)
{
*logofs << "Proxy: FLUSH! WARNING! Running with "
<< diffTimestamp(timeouts_.motionTs, getTimestamp())
- << " Ms elapsed since the last motion.\n"
+ << " ms elapsed since the last motion.\n"
<< logofs_flush;
}
*logofs << "Proxy: FLUSH! Requesting timeout of "
- << diffTs << " Ms as FD#" << fd << " has motion "
+ << diffTs << " ms as FD#" << fd << " has motion "
<< "events to send.\n" << logofs_flush;
#endif
@@ -1082,9 +1138,9 @@ int Proxy::handleRead()
// the failure is detected.
//
- int result = channels_[channelId] -> handleWrite(message, dataLength);
+ int _result = channels_[channelId] -> handleWrite(message, dataLength);
- if (result < 0 && finish == 0)
+ if (_result < 0 && finish == 0)
{
#ifdef TEST
*logofs << "Proxy: Failed to write proxy data to FD#"
@@ -1890,7 +1946,7 @@ int Proxy::handleEvents()
*logofs << "Proxy: FLUSH! Motion timeout expired after "
<< diffTimestamp(timeouts_.motionTs, getTimestamp())
- << " Ms.\n" << logofs_flush;
+ << " ms.\n" << logofs_flush;
#endif
@@ -1916,7 +1972,7 @@ int Proxy::handleEvents()
{
*logofs << "Proxy: Running with "
<< diffTimestamp(timeouts_.motionTs, getTimestamp())
- << " Ms elapsed since the last motion.\n"
+ << " ms elapsed since the last motion.\n"
<< logofs_flush;
}
#endif
@@ -1934,7 +1990,7 @@ int Proxy::handleEvents()
#if defined(TEST) || defined(INFO) || defined(SPLIT)
*logofs << "Proxy: SPLIT! Split timeout expired after "
<< diffTimestamp(timeouts_.splitTs, getTimestamp())
- << " Ms.\n" << logofs_flush;
+ << " ms.\n" << logofs_flush;
#endif
#if defined(TEST) || defined(INFO) || defined(SPLIT)
@@ -1977,7 +2033,7 @@ int Proxy::handleEvents()
{
*logofs << "Proxy: SPLIT! Running with "
<< diffTimestamp(timeouts_.splitTs, getTimestamp())
- << " Ms elapsed since the last split.\n"
+ << " ms elapsed since the last split.\n"
<< logofs_flush;
}
#endif
@@ -2196,7 +2252,7 @@ int Proxy::handleFrame(T_frame_type type)
<< " new " << outputLength << " flushable " << transport_ ->
flushable() << " tokens " << tokens_[token_control].remaining
<< " after " << diffTimestamp(timeouts_.writeTs, nowTs)
- << " Ms.\n" << logofs_flush;
+ << " ms.\n" << logofs_flush;
*logofs << "Proxy: FLUSH! Immediate flush to proxy FD#" << fd_
<< " of " << outputLength << " bytes at " << strMsTimestamp()
@@ -2220,7 +2276,7 @@ int Proxy::handleFrame(T_frame_type type)
*logofs << "Proxy: WARNING! TIME! Data written to proxy FD#"
<< fd_ << " at " << strMsTimestamp() << " after "
<< diffTimestamp(timeouts_.writeTs, nowTs)
- << " Ms.\n" << logofs_flush;
+ << " ms.\n" << logofs_flush;
}
#endif
@@ -2477,7 +2533,7 @@ int Proxy::handleDrain()
*logofs << "Proxy: Timeout raised while draining "
<< "FD#" << fd_ << " at " << strMsTimestamp()
<< " after " << diffTimestamp(startTs, nowTs)
- << " Ms.\n" << logofs_flush;
+ << " ms.\n" << logofs_flush;
#endif
result = 0;
@@ -2491,7 +2547,7 @@ int Proxy::handleDrain()
*logofs << "Proxy: Trying to write to FD#" << fd_
<< " at " << strMsTimestamp() << " with length "
<< transport_ -> length() << " and "
- << remaining << " Ms remaining.\n"
+ << remaining << " ms remaining.\n"
<< logofs_flush;
#endif
@@ -2534,7 +2590,7 @@ int Proxy::handleDrain()
#if defined(TEST) || defined(INFO)
*logofs << "Proxy: Waiting for more data from proxy "
<< "FD#" << fd_ << " at " << strMsTimestamp()
- << " with " << remaining << " Ms remaining.\n"
+ << " with " << remaining << " ms remaining.\n"
<< logofs_flush;
#endif
@@ -2577,7 +2633,7 @@ int Proxy::handleDrain()
*logofs << "Proxy: Got decongestion for proxy FD#"
<< fd_ << " at " << strMsTimestamp() << " after "
<< diffTimestamp(startTs, getTimestamp())
- << " Ms.\n" << logofs_flush;
+ << " ms.\n" << logofs_flush;
#endif
result = 1;
@@ -3042,31 +3098,19 @@ int Proxy::handleCloseAllXConnections()
int Proxy::handleCloseAllListeners()
{
- if (control -> isProtoStep7() == 1)
- {
- if (finish_ == 0)
- {
- #ifdef TEST
- *logofs << "Proxy: Closing down all remote listeners.\n"
- << logofs_flush;
- #endif
-
- if (handleControl(code_finish_listeners) < 0)
- {
- return -1;
- }
-
- finish_ = 1;
- }
- }
- else
+ // Since ProtoStep7 (#issue 108)
+ if (finish_ == 0)
{
#ifdef TEST
- *logofs << "Proxy: WARNING! Not sending unsupported "
- << "'code_finish_listeners' message.\n"
+ *logofs << "Proxy: Closing down all remote listeners.\n"
<< logofs_flush;
#endif
+ if (handleControl(code_finish_listeners) < 0)
+ {
+ return -1;
+ }
+
finish_ = 1;
}
@@ -3555,7 +3599,7 @@ int Proxy::handlePing()
#if defined(TEST) || defined(INFO)
*logofs << "Proxy: WARNING! No data received from "
<< "remote proxy on FD#" << fd_ << " since "
- << diffIn << " Ms.\n" << logofs_flush;
+ << diffIn << " ms.\n" << logofs_flush;
#endif
if (control -> ProxyTimeout > 0 &&
@@ -4215,6 +4259,12 @@ int Proxy::handleSaveStores()
char *cacheToAdopt = NULL;
+ //
+ // Set to false the indicator for cumulative store
+ // size too small
+ //
+ bool isTooSmall = false;
+
if (control -> PersistentCacheEnableSave)
{
#ifdef TEST
@@ -4222,7 +4272,7 @@ int Proxy::handleSaveStores()
<< logofs_flush;
#endif
- cacheToAdopt = handleSaveAllStores(control -> PersistentCachePath);
+ cacheToAdopt = handleSaveAllStores(control -> PersistentCachePath, isTooSmall);
}
#ifdef TEST
else
@@ -4274,21 +4324,28 @@ int Proxy::handleSaveStores()
return 1;
}
- #ifdef TEST
else
{
- *logofs << "Proxy: No cache file produced from message stores.\n"
- << logofs_flush;
- }
- #endif
+ #ifdef TEST
+ *logofs << "Proxy: No cache file produced from message stores.\n"
+ << logofs_flush;
+ #endif
- //
- // It can be that we didn't generate a new cache
- // because store was too small or persistent cache
- // was disabled. This is not an error.
- //
+ //
+ // It can be that we didn't generate a new cache
+ // because store was too small or persistent cache
+ // was disabled. This is not an error.
+ //
- return 0;
+ if (control -> PersistentCacheEnableSave && !isTooSmall)
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
}
int Proxy::handleLoadStores()
@@ -4539,15 +4596,8 @@ int Proxy::addTokenCodes(T_proxy_token &token)
int count = 0;
- if (control -> isProtoStep7() == 1)
- {
- count = token.bytes / token.size;
-
- if (count > 255)
- {
- count = 255;
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ count = token.bytes / token.size;
//
// Force a count of 1, for example
@@ -4562,6 +4612,12 @@ int Proxy::addTokenCodes(T_proxy_token &token)
}
else
{
+ // Since ProtoStep7 (#issue 108)
+ if (count > 255)
+ {
+ count = 255;
+ }
+
//
// Let the next token account for the
// remaining bytes.
@@ -4602,73 +4658,52 @@ int Proxy::handleToken(T_frame_type type)
if (type == frame_data)
{
- if (control -> isProtoStep7() == 1)
+ //
+ // Since ProtoStep7 (#issue 108)
+ //
+
+ // Send a distinct token for each data type.
+ // We don't want to slow down the sending of
+ // the X events, X replies and split confir-
+ // mation events on the X server side, so
+ // take care only of the generic data token.
+ //
+
+ if (control -> ProxyMode == proxy_client)
{
- //
- // Send a distinct token for each data type.
- // We don't want to slow down the sending of
- // the X events, X replies and split confir-
- // mation events on the X server side, so
- // take care only of the generic data token.
- //
+ statistics -> updateControlToken(tokens_[token_control].bytes);
- if (control -> ProxyMode == proxy_client)
+ if (tokens_[token_control].bytes > tokens_[token_control].size)
{
- statistics -> updateControlToken(tokens_[token_control].bytes);
-
- if (tokens_[token_control].bytes > tokens_[token_control].size)
+ if (addTokenCodes(tokens_[token_control]) < 0)
{
- if (addTokenCodes(tokens_[token_control]) < 0)
- {
- return -1;
- }
-
- #if defined(TEST) || defined(INFO) || defined(TOKEN)
-
- T_proxy_token &token = tokens_[token_control];
-
- *logofs << "Proxy: TOKEN! Token class ["
- << DumpToken(token.type) << "] has now "
- << token.bytes << " bytes accumulated and "
- << token.remaining << " tokens remaining.\n"
- << logofs_flush;
- #endif
+ return -1;
}
- statistics -> updateSplitToken(tokens_[token_split].bytes);
-
- if (tokens_[token_split].bytes > tokens_[token_split].size)
- {
- if (addTokenCodes(tokens_[token_split]) < 0)
- {
- return -1;
- }
-
- #if defined(TEST) || defined(INFO) || defined(TOKEN)
+ #if defined(TEST) || defined(INFO) || defined(TOKEN)
- T_proxy_token &token = tokens_[token_split];
+ T_proxy_token &token = tokens_[token_control];
- *logofs << "Proxy: TOKEN! Token class ["
- << DumpToken(token.type) << "] has now "
- << token.bytes << " bytes accumulated and "
- << token.remaining << " tokens remaining.\n"
- << logofs_flush;
- #endif
- }
+ *logofs << "Proxy: TOKEN! Token class ["
+ << DumpToken(token.type) << "] has now "
+ << token.bytes << " bytes accumulated and "
+ << token.remaining << " tokens remaining.\n"
+ << logofs_flush;
+ #endif
}
- statistics -> updateDataToken(tokens_[token_data].bytes);
+ statistics -> updateSplitToken(tokens_[token_split].bytes);
- if (tokens_[token_data].bytes > tokens_[token_data].size)
+ if (tokens_[token_split].bytes > tokens_[token_split].size)
{
- if (addTokenCodes(tokens_[token_data]) < 0)
+ if (addTokenCodes(tokens_[token_split]) < 0)
{
return -1;
}
#if defined(TEST) || defined(INFO) || defined(TOKEN)
- T_proxy_token &token = tokens_[token_data];
+ T_proxy_token &token = tokens_[token_split];
*logofs << "Proxy: TOKEN! Token class ["
<< DumpToken(token.type) << "] has now "
@@ -4678,37 +4713,26 @@ int Proxy::handleToken(T_frame_type type)
#endif
}
}
- else
- {
- //
- // Sum everything to the control token.
- //
- if (control -> ProxyMode == proxy_client)
- {
- statistics -> updateControlToken(tokens_[token_control].bytes);
- statistics -> updateSplitToken(tokens_[token_control].bytes);
- statistics -> updateDataToken(tokens_[token_control].bytes);
+ statistics -> updateDataToken(tokens_[token_data].bytes);
- if (tokens_[token_control].bytes > tokens_[token_control].size)
- {
- if (addTokenCodes(tokens_[token_control]) < 0)
- {
- return -1;
- }
+ if (tokens_[token_data].bytes > tokens_[token_data].size)
+ {
+ if (addTokenCodes(tokens_[token_data]) < 0)
+ {
+ return -1;
+ }
- #if defined(TEST) || defined(INFO) || defined(TOKEN)
+ #if defined(TEST) || defined(INFO) || defined(TOKEN)
- T_proxy_token &token = tokens_[token_control];
+ T_proxy_token &token = tokens_[token_data];
- *logofs << "Proxy: TOKEN! Token class ["
- << DumpToken(token.type) << "] has now "
- << token.bytes << " bytes accumulated and "
- << token.remaining << " tokens remaining.\n"
- << logofs_flush;
- #endif
- }
- }
+ *logofs << "Proxy: TOKEN! Token class ["
+ << DumpToken(token.type) << "] has now "
+ << token.bytes << " bytes accumulated and "
+ << token.remaining << " tokens remaining.\n"
+ << logofs_flush;
+ #endif
}
}
else
@@ -4770,21 +4794,10 @@ int Proxy::handleTokenFromProxy(T_proxy_token &token, int count)
<< count << ".\n" << logofs_flush;
#endif
- if (control -> isProtoStep7() == 0)
- {
- if (control -> ProxyMode == proxy_client ||
- token.request != code_control_token_request)
- {
- #ifdef PANIC
- *logofs << "Proxy: PANIC! Invalid token request received from remote.\n"
- << logofs_flush;
- #endif
-
- cerr << "Error" << ": Invalid token request received from remote.\n";
-
- HandleCleanup();
- }
- }
+ //
+ // Since ProtoStep7 (#issue 108) with no limitations
+ // concerning invalid token requests at this point
+ //
//
// Add our token reply.
@@ -4808,25 +4821,13 @@ int Proxy::handleTokenReplyFromProxy(T_proxy_token &token, int count)
#endif
//
- // Increment the available tokens.
+ // Since ProtoStep7 (#issue 108) with no limitations
+ // concerning invalid token requests at this point
//
- if (control -> isProtoStep7() == 0)
- {
- if (token.reply != code_control_token_reply)
- {
- #ifdef PANIC
- *logofs << "Proxy: PANIC! Invalid token reply received from remote.\n"
- << logofs_flush;
- #endif
-
- cerr << "Error" << ": Invalid token reply received from remote.\n";
-
- HandleCleanup();
- }
-
- count = 1;
- }
+ //
+ // Increment the available tokens.
+ //
token.remaining += count;
@@ -4917,24 +4918,10 @@ void Proxy::handleFailOnLoad(const char *fullName, const char *failContext) cons
int Proxy::handleSaveVersion(unsigned char *buffer, int &major,
int &minor, int &patch) const
{
- if (control -> isProtoStep8() == 1)
- {
- major = 3;
- minor = 0;
- patch = 0;
- }
- else if (control -> isProtoStep7() == 1)
- {
- major = 2;
- minor = 0;
- patch = 0;
- }
- else
- {
- major = 1;
- minor = 4;
- patch = 0;
- }
+ // Since ProtoStep8 (#issue 108)
+ major = 3;
+ minor = 0;
+ patch = 0;
*(buffer + 0) = major;
*(buffer + 1) = minor;
@@ -4957,33 +4944,19 @@ int Proxy::handleLoadVersion(const unsigned char *buffer, int &major,
// incompatible caches.
//
- if (control -> isProtoStep8() == 1)
- {
- if (major < 3)
- {
- return -1;
- }
- }
- else if (control -> isProtoStep7() == 1)
- {
- if (major < 2)
- {
- return -1;
- }
- }
- else
+ // Since ProtoStep8 (#issue 108)
+ if (major < 3)
{
- if (major != 1 && minor != 4)
- {
- return -1;
- }
+ return -1;
}
return 1;
}
-char *Proxy::handleSaveAllStores(const char *savePath) const
+char *Proxy::handleSaveAllStores(const char *savePath, bool & isTooSmall) const
{
+ isTooSmall = false;
+
int cumulativeSize = MessageStore::getCumulativeTotalStorageSize();
if (cumulativeSize < control -> PersistentCacheThreshold)
@@ -4995,6 +4968,13 @@ char *Proxy::handleSaveAllStores(const char *savePath) const
<< ".\n" << logofs_flush;
#endif
+ //
+ // Cumulative store size is smaller than threshold
+ // so the indicator is set to true
+ //
+
+ isTooSmall = true;
+
return NULL;
}
else if (savePath == NULL)
@@ -5030,20 +5010,28 @@ char *Proxy::handleSaveAllStores(const char *savePath) const
md5_state_t *md5StateClient = NULL;
md5_byte_t *md5DigestClient = NULL;
- char *tempName = NULL;
-
char md5String[MD5_LENGTH * 2 + 2];
char fullName[strlen(savePath) + MD5_LENGTH * 2 + 4];
- if (control -> ProxyMode == proxy_client)
- {
- tempName = tempnam(savePath, "Z-C-");
- }
- else
- {
- tempName = tempnam(savePath, "Z-S-");
- }
+ //
+ // Prepare the template for the temporary file
+ //
+
+ const char* const uniqueTemplate = "XXXXXX";
+ char tempName[strlen(savePath) + strlen("/") + 4 + strlen(uniqueTemplate) + 1];
+
+ snprintf(tempName, sizeof tempName, "%s/%s%s",
+ savePath,
+ control -> ProxyMode == proxy_client ?
+ "Z-C-" :
+ "Z-S-",
+ uniqueTemplate);
+
+ #ifdef TEST
+ *logofs << "Proxy: Generating temporary file with template '"
+ << tempName << "'.\n" << logofs_flush;
+ #endif
//
// Change the mask to make the file only
@@ -5053,35 +5041,68 @@ char *Proxy::handleSaveAllStores(const char *savePath) const
mode_t fileMode = umask(0077);
- cachefs = new ofstream(tempName, ios::out | ios::binary);
-
- umask(fileMode);
+ //
+ // Generate a unique temporary filename from tempName
+ // and then create and open the file
+ //
- if (tempName == NULL || cachefs == NULL)
+ int fdTemp = mkstemp(tempName);
+ if (fdTemp == -1)
{
#ifdef PANIC
*logofs << "Proxy: PANIC! Can't create temporary file in '"
- << savePath << "'.\n" << logofs_flush;
+ << savePath << "'. Cause = " << strerror(errno) << ".\n" << logofs_flush;
#endif
cerr << "Error" << ": Can't create temporary file in '"
- << savePath << "'.\n";
+ << savePath << "'. Cause = " << strerror(errno) << ".\n";
- if (tempName != NULL)
- {
- free(tempName);
- }
+ umask(fileMode);
- if (cachefs != NULL)
- {
- delete cachefs;
- }
+ EnableSignals();
+
+ return NULL;
+ }
+
+ #ifdef TEST
+ *logofs << "Proxy: Saving cache to file '"
+ << tempName << "'.\n" << logofs_flush;
+ #endif
+
+ //
+ // Create and open the output stream for the new temporary
+ // file
+ //
+
+ cachefs = new (std::nothrow) ofstream(tempName, ios::out | ios::binary);
+ if ((cachefs == NULL) || cachefs->fail())
+ {
+ #ifdef PANIC
+ *logofs << "Proxy: PANIC! Can't create stream for temporary file '"
+ << tempName << "'.\n" << logofs_flush;
+ #endif
+
+ cerr << "Error" << ": Can't create stream for temporary file '"
+ << tempName << "'.\n";
+
+ close(fdTemp);
+ unlink(tempName);
+
+ umask(fileMode);
EnableSignals();
return NULL;
}
+ //
+ // Close the file descriptor returned by mkstemp
+ // and restore the old mask
+ //
+
+ close(fdTemp);
+ umask(fileMode);
+
md5StateStream = new md5_state_t();
md5DigestStream = new md5_byte_t[MD5_LENGTH];
@@ -5114,8 +5135,6 @@ char *Proxy::handleSaveAllStores(const char *savePath) const
delete md5StateStream;
delete [] md5DigestStream;
- free(tempName);
-
EnableSignals();
return NULL;
@@ -5136,8 +5155,6 @@ char *Proxy::handleSaveAllStores(const char *savePath) const
delete md5StateStream;
delete [] md5DigestStream;
- free(tempName);
-
EnableSignals();
return NULL;
@@ -5169,7 +5186,7 @@ char *Proxy::handleSaveAllStores(const char *savePath) const
*(cacheDumpName + DEFAULT_STRING_LENGTH - 1) = '\0';
- mode_t fileMode = umask(0077);
+ fileMode = umask(0077);
cacheDump = new ofstream(cacheDumpName, ios::out);
@@ -5193,7 +5210,7 @@ char *Proxy::handleSaveAllStores(const char *savePath) const
#endif
- if (allSaved == 0)
+ if (allSaved == -1)
{
handleFailOnSave(tempName, "C");
@@ -5205,8 +5222,6 @@ char *Proxy::handleSaveAllStores(const char *savePath) const
delete md5StateClient;
delete [] md5DigestClient;
- free(tempName);
-
EnableSignals();
return NULL;
@@ -5246,8 +5261,6 @@ char *Proxy::handleSaveAllStores(const char *savePath) const
delete md5StateClient;
delete [] md5DigestClient;
- free(tempName);
-
EnableSignals();
return NULL;
@@ -5288,8 +5301,6 @@ char *Proxy::handleSaveAllStores(const char *savePath) const
delete md5StateClient;
delete [] md5DigestClient;
- free(tempName);
-
//
// Restore the original handlers.
//
@@ -5519,7 +5530,7 @@ const char *Proxy::handleLoadAllStores(const char *loadPath, const char *loadNam
md5_append(md5StateStream, (const md5_byte_t *) loadName, strlen(loadName));
md5_finish(md5StateStream, md5DigestStream);
- for (int i = 0; i < MD5_LENGTH; i++)
+ for (unsigned int i = 0; i < MD5_LENGTH; i++)
{
if (md5DigestStream[i] != md5FromFile[i])
{
@@ -5528,17 +5539,17 @@ const char *Proxy::handleLoadAllStores(const char *loadPath, const char *loadNam
*logofs << "Proxy: PANIC! Bad checksum for cache file '"
<< cacheName << "'.\n" << logofs_flush;
- for (unsigned int i = 0; i < MD5_LENGTH; i++)
+ for (unsigned int j = 0; j < MD5_LENGTH; j++)
{
- sprintf(md5String + (i * 2), "%02X", md5FromFile[i]);
+ sprintf(md5String + (j * 2), "%02X", md5FromFile[j]);
}
*logofs << "Proxy: PANIC! Saved checksum is '"
<< md5String << "'.\n" << logofs_flush;
- for (unsigned int i = 0; i < MD5_LENGTH; i++)
+ for (unsigned int j = 0; j < MD5_LENGTH; j++)
{
- sprintf(md5String + (i * 2),"%02X", md5DigestStream[i]);
+ sprintf(md5String + (j * 2),"%02X", md5DigestStream[i]);
}
*logofs << "Proxy: PANIC! Calculated checksum is '"
@@ -5782,14 +5793,14 @@ void Proxy::setSplitTimeout(int channelId)
for (T_list::iterator j = channelList.begin();
j != channelList.end(); j++)
{
- int channelId = *j;
+ int _channelId = *j;
- if (channels_[channelId] != NULL &&
- channels_[channelId] -> needSplit() == 1)
+ if (channels_[_channelId] != NULL &&
+ channels_[_channelId] -> needSplit() == 1)
{
#ifdef TEST
*logofs << "Proxy: SPLIT! Channel for FD#"
- << getFd(channelId) << " still needs splits.\n"
+ << getFd(_channelId) << " still needs splits.\n"
<< logofs_flush;
#endif
@@ -5829,14 +5840,14 @@ void Proxy::setMotionTimeout(int channelId)
for (T_list::iterator j = channelList.begin();
j != channelList.end(); j++)
{
- int channelId = *j;
+ int _channelId = *j;
- if (channels_[channelId] != NULL &&
- channels_[channelId] -> needMotion() == 1)
+ if (channels_[_channelId] != NULL &&
+ channels_[_channelId] -> needMotion() == 1)
{
#ifdef TEST
*logofs << "Proxy: SPLIT! Channel for FD#"
- << getFd(channelId) << " still needs motions.\n"
+ << getFd(_channelId) << " still needs motions.\n"
<< logofs_flush;
#endif
@@ -5952,11 +5963,11 @@ int Proxy::handleNewGenericConnection(int clientFd, T_channel_type type, const c
if (channelId == -1)
{
#ifdef PANIC
- *logofs << "Proxy: PANIC! Maximum mumber of available "
+ *logofs << "Proxy: PANIC! Maximum number of available "
<< "channels exceeded.\n" << logofs_flush;
#endif
- cerr << "Error" << ": Maximum mumber of available "
+ cerr << "Error" << ": Maximum number of available "
<< "channels exceeded.\n";
return -1;
@@ -6102,24 +6113,40 @@ int Proxy::handleNewGenericConnection(int clientFd, T_channel_type type, const c
int Proxy::handleNewSlaveConnection(int clientFd)
{
- if (control -> isProtoStep7() == 1)
- {
- return handleNewGenericConnection(clientFd, channel_slave, "slave");
+ // Since ProtoStep7 (#issue 108)
+ return handleNewGenericConnection(clientFd, channel_slave, "slave");
+}
+
+
+
+int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type type,
+ ChannelEndPoint &endPoint, const char *label)
+{
+ char *unixPath, *host;
+ long port;
+
+ if (endPoint.getUnixPath(&unixPath)) {
+ return handleNewGenericConnectionFromProxyUnix(channelId, type, unixPath, label);
}
- else
- {
- #ifdef TEST
- *logofs << "Proxy: WARNING! Not sending unsupported "
- << "'code_new_slave_connection' message.\n"
- << logofs_flush;
- #endif
- return -1;
+ if (endPoint.getTCPHostAndPort(&host, &port)) {
+ return handleNewGenericConnectionFromProxyTCP(channelId, type, host, port, label);
}
+
+ #ifdef WARNING
+ *logofs << "Proxy: WARNING! Refusing attempted connection "
+ << "to " << label << " server.\n" << logofs_flush;
+ #endif
+
+ cerr << "Warning" << ": Refusing attempted connection "
+ << "to " << label << " server.\n";
+
+ return -1;
}
-int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type type,
- const char *hostname, int port, const char *label)
+int Proxy::handleNewGenericConnectionFromProxyTCP(int channelId, T_channel_type type,
+ const char *hostname, long port, const char *label)
+
{
if (port <= 0)
{
@@ -6238,8 +6265,8 @@ int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type typ
return 1;
}
-int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type type,
- const char *hostname, const char *path, const char *label)
+int Proxy::handleNewGenericConnectionFromProxyUnix(int channelId, T_channel_type type,
+ const char *path, const char *label)
{
if (path == NULL || *path == '\0' )
{
@@ -6267,7 +6294,15 @@ int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type typ
serverAddrUnix.sun_family = AF_UNIX;
+ #ifdef __linux__
const int serverAddrNameLength = 108;
+ #else
+ /* POSIX/SUS does not specify a length.
+ * BSD derivatives generally support 104 bytes, other systems may be more constrained.
+ * If you happen to run into such systems, extend this section with the appropriate limit.
+ */
+ const int serverAddrNameLength = 104;
+ #endif
strncpy(serverAddrUnix.sun_path, path, serverAddrNameLength);
@@ -6336,42 +6371,94 @@ int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type typ
int Proxy::handleNewSlaveConnectionFromProxy(int channelId)
{
- //
- // Implementation is incomplete. Opening a
- // slave channel should let the proxy fork
- // a new client and pass to it the channel
- // descriptors. For now we make the channel
- // fail immediately.
- //
- // #include <fcntl.h>
- // #include <sys/types.h>
- // #include <sys/stat.h>
- //
- // char *slaveServer = "/dev/null";
- //
- // #ifdef TEST
- // *logofs << "Proxy: Opening file '" << slaveServer
- // << "'.\n" << logofs_flush;
- // #endif
- //
- // int serverFd = open(slaveServer, O_RDWR);
- //
- // if (handlePostConnectionFromProxy(channelId, serverFd, channel_slave, "slave") < 0)
- // {
- // return -1;
- // }
- //
- #ifdef WARNING
- *logofs << "Proxy: Refusing new slave connection for "
- << "channel ID#" << channelId << "\n"
- << logofs_flush;
- #endif
+ cerr << "Info" << ": New slave connection on "
+ << "channel ID#" << channelId << "\n";
- cerr << "Warning" << ": Refusing new slave connection for "
- << "channel ID#" << channelId << "\n";
+ char *nx_slave_cmd = getenv("NX_SLAVE_CMD");
+ if (nx_slave_cmd == NULL) {
+ return -1;
+ }
- return -1;
+ int spair[2];
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, spair) == -1) {
+ perror("socketpair");
+ return -1;
+ }
+
+ int serverFd = spair[0];
+ int clientFd = spair[1];
+
+ if (handlePostConnectionFromProxy(channelId, serverFd, channel_slave, "slave") < 0)
+ {
+ close(serverFd);
+ close(clientFd);
+ return -1;
+ }
+
+
+ int pid = fork();
+ if (pid == 0)
+ {
+
+ if (dup2(clientFd, 0) == -1)
+ {
+ perror("dup2");
+ exit(1);
+ }
+
+ if (dup2(clientFd, 1) == -1)
+ {
+ perror("dup2");
+ exit(1);
+ }
+
+ close(serverFd);
+ close(clientFd);
+
+ /* Close FDs used by NX, QVD #1208 */
+ for (int fd = 3; fd < 256; fd++) {
+ close(fd);
+ }
+
+ char *const argv[2] = {nx_slave_cmd, NULL};
+
+ if (execv(nx_slave_cmd, argv) == -1)
+ {
+ perror("execv");
+ }
+ exit(1);
+
+ }
+ else if (pid == -1)
+ {
+ // TODO Test this!
+ perror("fork");
+ close(serverFd);
+ close(clientFd);
+ return -1;
+ }
+
+ close(clientFd);
+ slavePidMap_[channelId] = pid;
+
+ cerr << "Info" << ": slave channel ID#" << channelId << " handler has PID " << pid << endl;
+
+ return 1;
+}
+
+void Proxy::checkSlaves()
+{
+ for (int channelId = 0; channelId<CONNECTIONS_LIMIT; channelId++)
+ {
+ int pid = slavePidMap_[channelId];
+
+ if (pid > 1 && HandleChild(pid))
+ {
+ slavePidMap_[channelId] = nothing;
+ cerr << "Info:" << " Handled death of slave with pid " << pid << endl;
+ }
+ }
}
int Proxy::handlePostConnectionFromProxy(int channelId, int serverFd,
diff --git a/nxcomp/Proxy.h b/nxcomp/src/Proxy.h
index 3d6c62c54..ea60c827a 100644
--- a/nxcomp/Proxy.h
+++ b/nxcomp/src/Proxy.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Proxy_H
@@ -32,6 +40,7 @@
#include "Transport.h"
#include "EncodeBuffer.h"
#include "ProxyReadBuffer.h"
+#include "ChannelEndPoint.h"
//
// Forward declaration as we
@@ -258,8 +267,11 @@ class Proxy
virtual void handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily,
sockaddr * xServerAddr, unsigned int xServerAddrLength) = 0;
- virtual void handlePortConfiguration(int cupsServerPort, int smbServerPort, int mediaServerPort,
- int httpServerPort, const char *fontServerPort) = 0;
+ virtual void handlePortConfiguration(ChannelEndPoint &cupsServerPort,
+ ChannelEndPoint &smbServerPort,
+ ChannelEndPoint &mediaServerPort,
+ ChannelEndPoint &httpServerPort,
+ const char *fontServerPort) = 0;
//
// Create new tunneled channels.
@@ -278,15 +290,20 @@ class Proxy
int handleNewGenericConnection(int clientFd, T_channel_type type, const char *label);
int handleNewGenericConnectionFromProxy(int channelId, T_channel_type type,
- const char *hostname, int port, const char *label);
+ ChannelEndPoint &endpoint, const char *label);
- int handleNewGenericConnectionFromProxy(int channelId, T_channel_type type,
- const char *hostname, const char *path, const char *label);
+ int handleNewGenericConnectionFromProxyUnix(int channelId, T_channel_type type,
+ const char *path, const char *label);
+
+ int handleNewGenericConnectionFromProxyTCP(int channelId, T_channel_type type,
+ const char *hostname, long port, const char *label);
int handleNewSlaveConnection(int clientFd);
int handleNewSlaveConnectionFromProxy(int channelId);
+ void checkSlaves();
+
//
// Force closure of channels.
//
@@ -767,11 +784,6 @@ class Proxy
handleSplitEvent(encodeBuffer_, split);
}
- int handleAsyncInit()
- {
- return handleFlush();
- }
-
int handleAsyncPriority()
{
if (control -> FlushPriority == 1)
@@ -990,7 +1002,7 @@ class Proxy
int handleLoadStores();
int handleSaveStores();
- char *handleSaveAllStores(const char *savePath) const;
+ char *handleSaveAllStores(const char *savePath, bool & isTooSmall) const;
virtual int handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream,
md5_state_t *md5StateClient) const = 0;
@@ -1258,6 +1270,7 @@ class Proxy
int channelMap_[CONNECTIONS_LIMIT];
int fdMap_[CONNECTIONS_LIMIT];
+ int slavePidMap_[CONNECTIONS_LIMIT];
};
#endif /* Proxy_H */
diff --git a/nxcomp/ProxyReadBuffer.cpp b/nxcomp/src/ProxyReadBuffer.cpp
index b0de14921..77f12771b 100644
--- a/nxcomp/ProxyReadBuffer.cpp
+++ b/nxcomp/src/ProxyReadBuffer.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ProxyReadBuffer.h"
#include "Transport.h"
@@ -50,7 +62,7 @@ unsigned int ProxyReadBuffer::suggestedLength(unsigned int pendingLength)
//
// Even if the readable data is not
// enough to make a complete message,
- // resize the buffer to accomodate
+ // resize the buffer to accommodate
// it all.
//
diff --git a/nxcomp/ProxyReadBuffer.h b/nxcomp/src/ProxyReadBuffer.h
index b87b215bf..68e9e95fa 100644
--- a/nxcomp/ProxyReadBuffer.h
+++ b/nxcomp/src/ProxyReadBuffer.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ProxyReadBuffer_H
diff --git a/nxcomp/PutImage.cpp b/nxcomp/src/PutImage.cpp
index 325a4aa66..d14f922c3 100644
--- a/nxcomp/PutImage.cpp
+++ b/nxcomp/src/PutImage.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "PutImage.h"
#include "ClientCache.h"
@@ -44,13 +56,9 @@ PutImageStore::PutImageStore(StaticCompressor *compressor)
{
enableCache = PUTIMAGE_ENABLE_CACHE;
enableData = PUTIMAGE_ENABLE_DATA;
- enableSplit = PUTIMAGE_ENABLE_SPLIT;
- enableCompress = PUTIMAGE_ENABLE_COMPRESS;
- if (control -> isProtoStep7() == 1)
- {
- enableCompress = PUTIMAGE_ENABLE_COMPRESS_IF_PROTO_STEP_7;
- }
+ // Since ProtoStep7 (#issue 108)
+ enableCompress = PUTIMAGE_ENABLE_COMPRESS_IF_PROTO_STEP_7;
dataLimit = PUTIMAGE_DATA_LIMIT;
dataOffset = PUTIMAGE_DATA_OFFSET;
@@ -59,10 +67,8 @@ PutImageStore::PutImageStore(StaticCompressor *compressor)
cacheThreshold = PUTIMAGE_CACHE_THRESHOLD;
cacheLowerThreshold = PUTIMAGE_CACHE_LOWER_THRESHOLD;
- if (control -> isProtoStep8() == 1)
- {
- enableSplit = PUTIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8;
- }
+ // Since ProtoStep8 (#issue 108)
+ enableSplit = PUTIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8;
messages_ -> resize(cacheSlots);
diff --git a/nxcomp/PutImage.h b/nxcomp/src/PutImage.h
index e9535cb29..93dde9dfb 100644
--- a/nxcomp/PutImage.h
+++ b/nxcomp/src/PutImage.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef PutImage_H
@@ -36,8 +44,6 @@
#define PUTIMAGE_ENABLE_CACHE 1
#define PUTIMAGE_ENABLE_DATA 1
-#define PUTIMAGE_ENABLE_SPLIT 1
-#define PUTIMAGE_ENABLE_COMPRESS 1
#define PUTIMAGE_DATA_LIMIT 262144 - 24
#define PUTIMAGE_DATA_OFFSET 24
diff --git a/nxcomp/PutPackedImage.cpp b/nxcomp/src/PutPackedImage.cpp
index eae16a16f..0bae2c0d4 100644
--- a/nxcomp/PutPackedImage.cpp
+++ b/nxcomp/src/PutPackedImage.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "PutPackedImage.h"
#include "ClientCache.h"
@@ -44,7 +56,6 @@ PutPackedImageStore::PutPackedImageStore(StaticCompressor *compressor)
{
enableCache = PUTPACKEDIMAGE_ENABLE_CACHE;
enableData = PUTPACKEDIMAGE_ENABLE_DATA;
- enableSplit = PUTPACKEDIMAGE_ENABLE_SPLIT;
enableCompress = PUTPACKEDIMAGE_ENABLE_COMPRESS;
dataLimit = PUTPACKEDIMAGE_DATA_LIMIT;
@@ -54,10 +65,8 @@ PutPackedImageStore::PutPackedImageStore(StaticCompressor *compressor)
cacheThreshold = PUTPACKEDIMAGE_CACHE_THRESHOLD;
cacheLowerThreshold = PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD;
- if (control -> isProtoStep8() == 1)
- {
- enableSplit = PUTPACKEDIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8;
- }
+ // Since ProtoStep8 (#issue 108)
+ enableSplit = PUTPACKEDIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8;
messages_ -> resize(cacheSlots);
diff --git a/nxcomp/PutPackedImage.h b/nxcomp/src/PutPackedImage.h
index 5287a5b57..d28ad39eb 100644
--- a/nxcomp/PutPackedImage.h
+++ b/nxcomp/src/PutPackedImage.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef PutPackedImage_H
@@ -36,7 +44,6 @@
#define PUTPACKEDIMAGE_ENABLE_CACHE 1
#define PUTPACKEDIMAGE_ENABLE_DATA 1
-#define PUTPACKEDIMAGE_ENABLE_SPLIT 1
#define PUTPACKEDIMAGE_ENABLE_COMPRESS 0
//
diff --git a/nxcomp/QueryFontReply.cpp b/nxcomp/src/QueryFontReply.cpp
index 2d42587f7..fde873140 100644
--- a/nxcomp/QueryFontReply.cpp
+++ b/nxcomp/src/QueryFontReply.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "QueryFontReply.h"
#include "ServerCache.h"
@@ -39,12 +51,9 @@ QueryFontReplyStore::QueryFontReplyStore(StaticCompressor *compressor)
enableCache = QUERYFONTREPLY_ENABLE_CACHE;
enableData = QUERYFONTREPLY_ENABLE_DATA;
enableSplit = QUERYFONTREPLY_ENABLE_SPLIT;
- enableCompress = QUERYFONTREPLY_ENABLE_COMPRESS;
- if (control -> isProtoStep7() == 1)
- {
- enableCompress = QUERYFONTREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7;
- }
+ // Since ProtoStep7 (#issue 108)
+ enableCompress = QUERYFONTREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7;
dataLimit = QUERYFONTREPLY_DATA_LIMIT;
dataOffset = QUERYFONTREPLY_DATA_OFFSET;
diff --git a/nxcomp/QueryFontReply.h b/nxcomp/src/QueryFontReply.h
index 537da4e63..e12fe4e4b 100644
--- a/nxcomp/QueryFontReply.h
+++ b/nxcomp/src/QueryFontReply.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef QueryFontReply_H
@@ -36,7 +44,6 @@
#define QUERYFONTREPLY_ENABLE_CACHE 1
#define QUERYFONTREPLY_ENABLE_DATA 1
#define QUERYFONTREPLY_ENABLE_SPLIT 0
-#define QUERYFONTREPLY_ENABLE_COMPRESS 1
#define QUERYFONTREPLY_DATA_LIMIT 1048576 - 32
#define QUERYFONTREPLY_DATA_OFFSET 8
diff --git a/nxcomp/ReadBuffer.cpp b/nxcomp/src/ReadBuffer.cpp
index 13122e278..154225e75 100644
--- a/nxcomp/ReadBuffer.cpp
+++ b/nxcomp/src/ReadBuffer.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ReadBuffer.h"
#include "Transport.h"
diff --git a/nxcomp/ReadBuffer.h b/nxcomp/src/ReadBuffer.h
index 20130120a..a12bcc9b3 100644
--- a/nxcomp/ReadBuffer.h
+++ b/nxcomp/src/ReadBuffer.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ReadBuffer_H
diff --git a/nxcomp/RenderAddGlyphs.cpp b/nxcomp/src/RenderAddGlyphs.cpp
index 1d53ec0f8..ef13d6890 100644
--- a/nxcomp/RenderAddGlyphs.cpp
+++ b/nxcomp/src/RenderAddGlyphs.cpp
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
//
@@ -20,6 +28,10 @@
// this message class.
//
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "RenderAddGlyphs.h"
//
diff --git a/nxcomp/RenderAddGlyphs.h b/nxcomp/src/RenderAddGlyphs.h
index 918a70c8d..d3c8cd158 100644
--- a/nxcomp/RenderAddGlyphs.h
+++ b/nxcomp/src/RenderAddGlyphs.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderAddGlyphs_H
diff --git a/nxcomp/RenderChangePicture.cpp b/nxcomp/src/RenderChangePicture.cpp
index 5dbe39d52..d202b92ad 100644
--- a/nxcomp/RenderChangePicture.cpp
+++ b/nxcomp/src/RenderChangePicture.cpp
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
//
@@ -20,6 +28,10 @@
// this message class.
//
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "RenderChangePicture.h"
//
diff --git a/nxcomp/RenderChangePicture.h b/nxcomp/src/RenderChangePicture.h
index e6a89a610..4bab1ef98 100644
--- a/nxcomp/RenderChangePicture.h
+++ b/nxcomp/src/RenderChangePicture.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderChangePicture_H
diff --git a/nxcomp/RenderComposite.cpp b/nxcomp/src/RenderComposite.cpp
index e3c121b48..f82f80f06 100644
--- a/nxcomp/RenderComposite.cpp
+++ b/nxcomp/src/RenderComposite.cpp
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
//
@@ -20,6 +28,10 @@
// this message class.
//
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "RenderComposite.h"
//
diff --git a/nxcomp/RenderComposite.h b/nxcomp/src/RenderComposite.h
index 91fa30aaa..aafa1e776 100644
--- a/nxcomp/RenderComposite.h
+++ b/nxcomp/src/RenderComposite.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderComposite_H
diff --git a/nxcomp/RenderCompositeGlyphs.cpp b/nxcomp/src/RenderCompositeGlyphs.cpp
index 1135633ff..0949d3e2c 100644
--- a/nxcomp/RenderCompositeGlyphs.cpp
+++ b/nxcomp/src/RenderCompositeGlyphs.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
//
// Include the template for
// this message class.
@@ -102,26 +114,14 @@ MESSAGE_BEGIN_ENCODE_MESSAGE
unsigned int src_x = GetUINT(buffer + 24, bigEndian);
unsigned int src_y = GetUINT(buffer + 26, bigEndian);
- if (control -> isProtoStep8() == 1)
- {
- encodeBuffer.encodeDiffCachedValue(src_x,
- clientCache -> renderGlyphX, 16,
- clientCache -> renderGlyphXCache, 11);
-
- encodeBuffer.encodeDiffCachedValue(src_y,
- clientCache -> renderGlyphY, 16,
- clientCache -> renderGlyphYCache, 11);
- }
- else
- {
- encodeBuffer.encodeDiffCachedValue(src_x,
- clientCache -> renderLastX, 16,
- clientCache -> renderXCache, 11);
+ // Since ProtoStep8 (#issue 108)
+ encodeBuffer.encodeDiffCachedValue(src_x,
+ clientCache -> renderGlyphX, 16,
+ clientCache -> renderGlyphXCache, 11);
- encodeBuffer.encodeDiffCachedValue(src_y,
- clientCache -> renderLastY, 16,
- clientCache -> renderYCache, 11);
- }
+ encodeBuffer.encodeDiffCachedValue(src_y,
+ clientCache -> renderGlyphY, 16,
+ clientCache -> renderGlyphYCache, 11);
#ifdef TEST
*logofs << name() << ": Encoded source X "
@@ -147,8 +147,8 @@ MESSAGE_BEGIN_ENCODE_MESSAGE
// tive to the first offset coordinates.
//
- if (control -> isProtoStep8() == 1 &&
- size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
+ // Since ProtoStep8 (#issue 108)
+ if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
{
unsigned int numGlyphs = *(buffer + 28);
@@ -232,32 +232,20 @@ MESSAGE_BEGIN_DECODE_MESSAGE
unsigned int src_x;
unsigned int src_y;
- if (control -> isProtoStep8() == 1)
- {
- decodeBuffer.decodeDiffCachedValue(src_x,
- clientCache -> renderGlyphX, 16,
- clientCache -> renderGlyphXCache, 11);
-
- decodeBuffer.decodeDiffCachedValue(src_y,
- clientCache -> renderGlyphY, 16,
- clientCache -> renderGlyphYCache, 11);
- }
- else
- {
- decodeBuffer.decodeDiffCachedValue(src_x,
- clientCache -> renderLastX, 16,
- clientCache -> renderXCache, 11);
+ // Since ProtoStep8 (#issue 108)
+ decodeBuffer.decodeDiffCachedValue(src_x,
+ clientCache -> renderGlyphX, 16,
+ clientCache -> renderGlyphXCache, 11);
- decodeBuffer.decodeDiffCachedValue(src_y,
- clientCache -> renderLastY, 16,
- clientCache -> renderYCache, 11);
- }
+ decodeBuffer.decodeDiffCachedValue(src_y,
+ clientCache -> renderGlyphY, 16,
+ clientCache -> renderGlyphYCache, 11);
PutUINT(src_x, buffer + 24, bigEndian);
PutUINT(src_y, buffer + 26, bigEndian);
- if (control -> isProtoStep8() == 1 &&
- size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
+ // Since ProtoStep8 (#issue 108)
+ if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
{
decodeBuffer.decodeCachedValue(value, 8,
clientCache -> renderNumGlyphsCache);
@@ -297,8 +285,8 @@ MESSAGE_END_DECODE_MESSAGE
MESSAGE_BEGIN_ENCODE_DATA
{
- if (control -> isProtoStep8() == 1 &&
- size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
+ // Since ProtoStep8 (#issue 108)
+ if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
{
encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET_IF_PROTO_STEP_8,
size, bigEndian, channelCache);
@@ -318,8 +306,8 @@ MESSAGE_END_ENCODE_DATA
MESSAGE_BEGIN_DECODE_DATA
{
- if (control -> isProtoStep8() == 1 &&
- size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
+ // Since ProtoStep8 (#issue 108)
+ if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
{
decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET_IF_PROTO_STEP_8,
size, bigEndian, channelCache);
@@ -353,8 +341,8 @@ MESSAGE_BEGIN_PARSE_IDENTITY
renderExtension -> data.composite_glyphs.src_x = GetUINT(buffer + 24, bigEndian);
renderExtension -> data.composite_glyphs.src_y = GetUINT(buffer + 26, bigEndian);
- if (control -> isProtoStep8() == 1 &&
- size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
+ // Since ProtoStep8 (#issue 108)
+ if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
{
renderExtension -> data.composite_glyphs.num_elm = *(buffer + 28);
@@ -387,8 +375,8 @@ MESSAGE_BEGIN_UNPARSE_IDENTITY
PutUINT(renderExtension -> data.composite_glyphs.src_x, buffer + 24, bigEndian);
PutUINT(renderExtension -> data.composite_glyphs.src_y, buffer + 26, bigEndian);
- if (control -> isProtoStep8() == 1 &&
- size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
+ // Since ProtoStep8 (#issue 108)
+ if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
{
*(buffer + 28) = renderExtension -> data.composite_glyphs.num_elm;
@@ -426,8 +414,8 @@ MESSAGE_BEGIN_IDENTITY_CHECKSUM
// first string.
//
- if (control -> isProtoStep8() == 1 &&
- size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
+ // Since ProtoStep8 (#issue 108)
+ if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
{
md5_append(md5_state, buffer + 28, 1);
}
@@ -470,42 +458,22 @@ MESSAGE_BEGIN_ENCODE_UPDATE
unsigned int value;
unsigned int previous;
- if (control -> isProtoStep8() == 1)
- {
- value = renderExtension -> data.composite_glyphs.src_x;
- previous = cachedRenderExtension -> data.composite_glyphs.src_x;
+ // Since ProtoStep8 (#issue 108)
+ value = renderExtension -> data.composite_glyphs.src_x;
+ previous = cachedRenderExtension -> data.composite_glyphs.src_x;
- encodeBuffer.encodeDiffCachedValue(value, previous, 16,
- clientCache -> renderGlyphXCache, 11);
+ encodeBuffer.encodeDiffCachedValue(value, previous, 16,
+ clientCache -> renderGlyphXCache, 11);
- cachedRenderExtension -> data.composite_glyphs.src_x = value;
+ cachedRenderExtension -> data.composite_glyphs.src_x = value;
- value = renderExtension -> data.composite_glyphs.src_y;
- previous = cachedRenderExtension -> data.composite_glyphs.src_y;
+ value = renderExtension -> data.composite_glyphs.src_y;
+ previous = cachedRenderExtension -> data.composite_glyphs.src_y;
- encodeBuffer.encodeDiffCachedValue(value, previous, 16,
- clientCache -> renderGlyphYCache, 11);
+ encodeBuffer.encodeDiffCachedValue(value, previous, 16,
+ clientCache -> renderGlyphYCache, 11);
- cachedRenderExtension -> data.composite_glyphs.src_y = value;
- }
- else
- {
- value = renderExtension -> data.composite_glyphs.src_x;
- previous = cachedRenderExtension -> data.composite_glyphs.src_x;
-
- encodeBuffer.encodeDiffCachedValue(value, previous, 16,
- clientCache -> renderXCache, 11);
-
- cachedRenderExtension -> data.composite_glyphs.src_x = value;
-
- value = renderExtension -> data.composite_glyphs.src_y;
- previous = cachedRenderExtension -> data.composite_glyphs.src_y;
-
- encodeBuffer.encodeDiffCachedValue(value, previous, 16,
- clientCache -> renderYCache, 11);
-
- cachedRenderExtension -> data.composite_glyphs.src_y = value;
- }
+ cachedRenderExtension -> data.composite_glyphs.src_y = value;
#ifdef TEST
*logofs << name() << ": Encoded source X "
@@ -514,8 +482,8 @@ MESSAGE_BEGIN_ENCODE_UPDATE
<< logofs_flush;
#endif
- if (control -> isProtoStep8() == 1 &&
- renderExtension -> size_ >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
+ // Since ProtoStep8 (#issue 108)
+ if (renderExtension -> size_ >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
{
//
// Offset X and Y.
@@ -601,41 +569,23 @@ MESSAGE_BEGIN_DECODE_UPDATE
unsigned int value;
unsigned int previous;
- if (control -> isProtoStep8() == 1)
- {
- previous = renderExtension -> data.composite_glyphs.src_x;
+ // Since ProtoStep8 (#issue 108)
+ previous = renderExtension -> data.composite_glyphs.src_x;
- decodeBuffer.decodeDiffCachedValue(value, previous, 16,
- clientCache -> renderGlyphXCache, 11);
+ decodeBuffer.decodeDiffCachedValue(value, previous, 16,
+ clientCache -> renderGlyphXCache, 11);
- renderExtension -> data.composite_glyphs.src_x = value;
+ renderExtension -> data.composite_glyphs.src_x = value;
- previous = renderExtension -> data.composite_glyphs.src_y;
+ previous = renderExtension -> data.composite_glyphs.src_y;
- decodeBuffer.decodeDiffCachedValue(value, previous, 16,
- clientCache -> renderGlyphYCache, 11);
+ decodeBuffer.decodeDiffCachedValue(value, previous, 16,
+ clientCache -> renderGlyphYCache, 11);
- renderExtension -> data.composite_glyphs.src_y = value;
- }
- else
- {
- previous = renderExtension -> data.composite_glyphs.src_x;
-
- decodeBuffer.decodeDiffCachedValue(value, previous, 16,
- clientCache -> renderXCache, 11);
-
- renderExtension -> data.composite_glyphs.src_x = value;
-
- previous = renderExtension -> data.composite_glyphs.src_y;
-
- decodeBuffer.decodeDiffCachedValue(value, previous, 16,
- clientCache -> renderYCache, 11);
-
- renderExtension -> data.composite_glyphs.src_y = value;
- }
+ renderExtension -> data.composite_glyphs.src_y = value;
- if (control -> isProtoStep8() == 1 &&
- renderExtension -> size_ >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
+ // Since ProtoStep8 (#issue 108)
+ if (renderExtension -> size_ >= MESSAGE_OFFSET_IF_PROTO_STEP_8)
{
//
// Offset X and Y.
diff --git a/nxcomp/RenderCompositeGlyphs.h b/nxcomp/src/RenderCompositeGlyphs.h
index 527fd3d12..1062ee781 100644
--- a/nxcomp/RenderCompositeGlyphs.h
+++ b/nxcomp/src/RenderCompositeGlyphs.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderCompositeGlyphs_H
@@ -80,9 +88,8 @@ class MESSAGE_STORE : public MESSAGE_CLASS
virtual int identitySize(const unsigned char *buffer,
unsigned int size)
{
- unsigned int offset = (control -> isProtoStep8() == 1 ?
- MESSAGE_OFFSET_IF_PROTO_STEP_8 :
- MESSAGE_OFFSET);
+ // Since ProtoStep8 (#issue 108)
+ unsigned int offset = MESSAGE_OFFSET_IF_PROTO_STEP_8;
return (size >= offset ? offset : size);
}
diff --git a/nxcomp/RenderCreateGlyphSet.cpp b/nxcomp/src/RenderCreateGlyphSet.cpp
index b9da8d7bf..e3a842de9 100644
--- a/nxcomp/RenderCreateGlyphSet.cpp
+++ b/nxcomp/src/RenderCreateGlyphSet.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
//
// Include the template for
// this message class.
diff --git a/nxcomp/RenderCreateGlyphSet.h b/nxcomp/src/RenderCreateGlyphSet.h
index 0f14ce0c5..10f5d6699 100644
--- a/nxcomp/RenderCreateGlyphSet.h
+++ b/nxcomp/src/RenderCreateGlyphSet.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderCreateGlyphSet_H
diff --git a/nxcomp/RenderCreatePicture.cpp b/nxcomp/src/RenderCreatePicture.cpp
index cb3d56534..f3f9f8b8a 100644
--- a/nxcomp/RenderCreatePicture.cpp
+++ b/nxcomp/src/RenderCreatePicture.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
//
// Include the template for
// this message class.
diff --git a/nxcomp/RenderCreatePicture.h b/nxcomp/src/RenderCreatePicture.h
index 35de9b86b..ae2f583a0 100644
--- a/nxcomp/RenderCreatePicture.h
+++ b/nxcomp/src/RenderCreatePicture.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderCreatePicture_H
diff --git a/nxcomp/RenderExtension.cpp b/nxcomp/src/RenderExtension.cpp
index 79c26e64e..64761bc05 100644
--- a/nxcomp/RenderExtension.cpp
+++ b/nxcomp/src/RenderExtension.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "NXrender.h"
#include "ClientCache.h"
@@ -42,13 +54,6 @@
#include "RenderTrapezoids.h"
#include "RenderTriangles.h"
-#include "RenderCreatePictureCompat.h"
-#include "RenderFreePictureCompat.h"
-#include "RenderPictureClipCompat.h"
-#include "RenderCreateGlyphSetCompat.h"
-#include "RenderCompositeCompat.h"
-#include "RenderCompositeGlyphsCompat.h"
-
//
// Set the verbosity level.
//
@@ -82,46 +87,27 @@ RenderExtensionStore::RenderExtensionStore(StaticCompressor *compressor)
minors_[X_RenderFillRectangles] = new RenderFillRectanglesStore();
minors_[X_RenderAddGlyphs] = new RenderAddGlyphsStore();
- if (control -> isProtoStep7() == 1)
- {
- minors_[X_RenderCreatePicture] = new RenderCreatePictureStore();
- minors_[X_RenderFreePicture] = new RenderFreePictureStore();
- minors_[X_RenderSetPictureClipRectangles] = new RenderPictureClipStore();
- minors_[X_RenderCreateGlyphSet] = new RenderCreateGlyphSetStore();
- minors_[X_RenderComposite] = new RenderCompositeStore();
- minors_[X_RenderCompositeGlyphs8] = new RenderCompositeGlyphsStore();
- minors_[X_RenderCompositeGlyphs16] = new RenderCompositeGlyphsStore();
- minors_[X_RenderCompositeGlyphs32] = new RenderCompositeGlyphsStore();
-
- minors_[X_RenderSetPictureTransform] = new RenderPictureTransformStore();
- minors_[X_RenderSetPictureFilter] = new RenderPictureFilterStore();
- minors_[X_RenderFreeGlyphSet] = new RenderFreeGlyphSetStore();
- minors_[X_RenderTrapezoids] = new RenderTrapezoidsStore();
- minors_[X_RenderTriangles] = new RenderTrianglesStore();
- }
- else
- {
- minors_[X_RenderCreatePicture] = new RenderCreatePictureCompatStore();
- minors_[X_RenderFreePicture] = new RenderFreePictureCompatStore();
- minors_[X_RenderSetPictureClipRectangles] = new RenderPictureClipCompatStore();
- minors_[X_RenderCreateGlyphSet] = new RenderCreateGlyphSetCompatStore();
- minors_[X_RenderComposite] = new RenderCompositeCompatStore();
- minors_[X_RenderCompositeGlyphs8] = new RenderCompositeGlyphsCompatStore();
- minors_[X_RenderCompositeGlyphs16] = new RenderCompositeGlyphsCompatStore();
- minors_[X_RenderCompositeGlyphs32] = new RenderCompositeGlyphsCompatStore();
- }
+ // Since ProtoStep7 (#issue 108)
+ minors_[X_RenderCreatePicture] = new RenderCreatePictureStore();
+ minors_[X_RenderFreePicture] = new RenderFreePictureStore();
+ minors_[X_RenderSetPictureClipRectangles] = new RenderPictureClipStore();
+ minors_[X_RenderCreateGlyphSet] = new RenderCreateGlyphSetStore();
+ minors_[X_RenderComposite] = new RenderCompositeStore();
+ minors_[X_RenderCompositeGlyphs8] = new RenderCompositeGlyphsStore();
+ minors_[X_RenderCompositeGlyphs16] = new RenderCompositeGlyphsStore();
+ minors_[X_RenderCompositeGlyphs32] = new RenderCompositeGlyphsStore();
+
+ minors_[X_RenderSetPictureTransform] = new RenderPictureTransformStore();
+ minors_[X_RenderSetPictureFilter] = new RenderPictureFilterStore();
+ minors_[X_RenderFreeGlyphSet] = new RenderFreeGlyphSetStore();
+ minors_[X_RenderTrapezoids] = new RenderTrapezoidsStore();
+ minors_[X_RenderTriangles] = new RenderTrianglesStore();
dataLimit = RENDEREXTENSION_DATA_LIMIT;
dataOffset = RENDEREXTENSION_DATA_OFFSET;
- if (control -> isProtoStep7() == 1)
- {
- cacheSlots = RENDEREXTENSION_CACHE_SLOTS_IF_PROTO_STEP_7;
- }
- else
- {
- cacheSlots = RENDEREXTENSION_CACHE_SLOTS;
- }
+ // Since ProtoStep7 (#issue 108)
+ cacheSlots = RENDEREXTENSION_CACHE_SLOTS_IF_PROTO_STEP_7;
cacheThreshold = RENDEREXTENSION_CACHE_THRESHOLD;
cacheLowerThreshold = RENDEREXTENSION_CACHE_LOWER_THRESHOLD;
@@ -268,204 +254,78 @@ void RenderMinorExtensionStore::encodeLongData(EncodeBuffer &encodeBuffer, const
unsigned int offset, unsigned int size, int bigEndian,
ChannelCache *channelCache) const
{
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeLongData(buffer + offset, size - offset);
-
- #ifdef TEST
- *logofs << name() << ": Encoded " << size - offset
- << " bytes of long data.\n" << logofs_flush;
- #endif
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeLongData(buffer + offset, size - offset);
- return;
- }
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- for (unsigned int i = offset, c = (offset - 4) % 16; i < size; i += 4)
- {
- #ifdef DEBUG
- *logofs << name() << ": Encoding int with i = " << i << " c = "
- << c << ".\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeCachedValue(GetULONG(buffer + i, bigEndian), 32,
- *clientCache -> renderDataCache[c]);
-
- if (++c == 16) c = 0;
- }
+ #ifdef TEST
+ *logofs << name() << ": Encoded " << size - offset
+ << " bytes of long data.\n" << logofs_flush;
+ #endif
}
void RenderMinorExtensionStore::encodeIntData(EncodeBuffer &encodeBuffer, const unsigned char *buffer,
unsigned int offset, unsigned int size, int bigEndian,
ChannelCache *channelCache) const
{
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeIntData(buffer + offset, size - offset);
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeIntData(buffer + offset, size - offset);
- #ifdef TEST
- *logofs << name() << ": Encoded " << size - offset
- << " bytes of int data.\n" << logofs_flush;
- #endif
-
- return;
- }
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- for (unsigned int i = offset, c = (offset - 4) % 16; i < size; i += 2)
- {
- #ifdef DEBUG
- *logofs << name() << ": Encoding int with i = " << i << " c = "
- << c << ".\n" << logofs_flush;
- #endif
-
- encodeBuffer.encodeCachedValue(GetUINT(buffer + i, bigEndian), 16,
- *clientCache -> renderDataCache[c]);
-
- if (++c == 16) c = 0;
- }
+ #ifdef TEST
+ *logofs << name() << ": Encoded " << size - offset
+ << " bytes of int data.\n" << logofs_flush;
+ #endif
}
void RenderMinorExtensionStore::encodeCharData(EncodeBuffer &encodeBuffer, const unsigned char *buffer,
unsigned int offset, unsigned int size, int bigEndian,
ChannelCache *channelCache) const
{
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(buffer + offset, size - offset);
-
- #ifdef TEST
- *logofs << name() << ": Encoded " << size - offset
- << " bytes of text data.\n" << logofs_flush;
- #endif
-
- return;
- }
-
- ClientCache *clientCache = (ClientCache *) channelCache;
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(buffer + offset, size - offset);
- clientCache -> renderTextCompressor.reset();
-
- const unsigned char *next = buffer + offset;
-
- for (unsigned int i = offset; i < size; i++)
- {
- #ifdef DEBUG
- *logofs << name() << ": Encoding char with i = " << i
- << ".\n" << logofs_flush;
- #endif
-
- clientCache -> renderTextCompressor.
- encodeChar(*next++, encodeBuffer);
- }
+ #ifdef TEST
+ *logofs << name() << ": Encoded " << size - offset
+ << " bytes of text data.\n" << logofs_flush;
+ #endif
}
void RenderMinorExtensionStore::decodeLongData(DecodeBuffer &decodeBuffer, unsigned char *buffer,
unsigned int offset, unsigned int size, int bigEndian,
ChannelCache *channelCache) const
{
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeLongData(buffer + offset, size - offset);
-
- #ifdef TEST
- *logofs << name() << ": Decoded " << size - offset
- << " bytes of long data.\n" << logofs_flush;
- #endif
-
- return;
- }
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- for (unsigned int i = offset, c = (offset - 4) % 16; i < size; i += 4)
- {
- #ifdef DEBUG
- *logofs << name() << ": Decoding int with i = " << i << " c = "
- << c << ".\n" << logofs_flush;
- #endif
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeLongData(buffer + offset, size - offset);
- decodeBuffer.decodeCachedValue(value, 32,
- *clientCache -> renderDataCache[c]);
-
- PutULONG(value, buffer + i, bigEndian);
-
- if (++c == 16) c = 0;
- }
+ #ifdef TEST
+ *logofs << name() << ": Decoded " << size - offset
+ << " bytes of long data.\n" << logofs_flush;
+ #endif
}
void RenderMinorExtensionStore::decodeIntData(DecodeBuffer &decodeBuffer, unsigned char *buffer,
unsigned int offset, unsigned int size, int bigEndian,
ChannelCache *channelCache) const
{
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeIntData(buffer + offset, size - offset);
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeIntData(buffer + offset, size - offset);
- #ifdef TEST
- *logofs << name() << ": Decoded " << size - offset
- << " bytes of int data.\n" << logofs_flush;
- #endif
-
- return;
- }
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- unsigned int value;
-
- for (unsigned int i = offset, c = (offset - 4) % 16; i < size; i += 2)
- {
- #ifdef DEBUG
- *logofs << name() << ": Decoding int with i = " << i << " c = "
- << c << ".\n" << logofs_flush;
- #endif
-
- decodeBuffer.decodeCachedValue(value, 16,
- *clientCache -> renderDataCache[c]);
-
- PutUINT(value, buffer + i, bigEndian);
-
- if (++c == 16) c = 0;
- }
+ #ifdef TEST
+ *logofs << name() << ": Decoded " << size - offset
+ << " bytes of int data.\n" << logofs_flush;
+ #endif
}
void RenderMinorExtensionStore::decodeCharData(DecodeBuffer &decodeBuffer, unsigned char *buffer,
unsigned int offset, unsigned int size, int bigEndian,
ChannelCache *channelCache) const
{
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(buffer + offset, size - offset);
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(buffer + offset, size - offset);
- #ifdef TEST
- *logofs << name() << ": Decoded " << size - offset
- << " bytes of text data.\n" << logofs_flush;
- #endif
-
- return;
- }
-
- ClientCache *clientCache = (ClientCache *) channelCache;
-
- clientCache -> renderTextCompressor.reset();
-
- unsigned char *next = buffer + offset;
-
- for (unsigned int i = offset; i < size; i++)
- {
- #ifdef DEBUG
- *logofs << name() << ": Decoding char with i = " << i
- << ".\n" << logofs_flush;
- #endif
-
- *next++ = clientCache -> renderTextCompressor.
- decodeChar(decodeBuffer);
- }
+ #ifdef TEST
+ *logofs << name() << ": Decoded " << size - offset
+ << " bytes of text data.\n" << logofs_flush;
+ #endif
}
void RenderMinorExtensionStore::parseIntData(const Message *message, const unsigned char *buffer,
diff --git a/nxcomp/RenderExtension.h b/nxcomp/src/RenderExtension.h
index 275ef1c1d..aa9db1b55 100644
--- a/nxcomp/RenderExtension.h
+++ b/nxcomp/src/RenderExtension.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderExtension_H
@@ -44,7 +52,6 @@
#define RENDEREXTENSION_DATA_LIMIT 6144
#define RENDEREXTENSION_DATA_OFFSET 36
-#define RENDEREXTENSION_CACHE_SLOTS 6000
#define RENDEREXTENSION_CACHE_THRESHOLD 20
#define RENDEREXTENSION_CACHE_LOWER_THRESHOLD 10
@@ -83,13 +90,6 @@ class RenderExtensionMessage : public Message
friend class RenderTrapezoidsStore;
friend class RenderTrianglesStore;
- friend class RenderCreatePictureCompatStore;
- friend class RenderFreePictureCompatStore;
- friend class RenderPictureClipCompatStore;
- friend class RenderCreateGlyphSetCompatStore;
- friend class RenderCompositeCompatStore;
- friend class RenderCompositeGlyphsCompatStore;
-
public:
RenderExtensionMessage()
diff --git a/nxcomp/RenderFillRectangles.cpp b/nxcomp/src/RenderFillRectangles.cpp
index 6f08d97a4..db05887ab 100644
--- a/nxcomp/RenderFillRectangles.cpp
+++ b/nxcomp/src/RenderFillRectangles.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
//
// Include the template for
// this message class.
diff --git a/nxcomp/RenderFillRectangles.h b/nxcomp/src/RenderFillRectangles.h
index 189855907..9efaeffa8 100644
--- a/nxcomp/RenderFillRectangles.h
+++ b/nxcomp/src/RenderFillRectangles.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderFillRectangles_H
diff --git a/nxcomp/RenderFreeGlyphSet.cpp b/nxcomp/src/RenderFreeGlyphSet.cpp
index 50010e381..88dfb791a 100644
--- a/nxcomp/RenderFreeGlyphSet.cpp
+++ b/nxcomp/src/RenderFreeGlyphSet.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
//
// Include the template for
// this message class.
diff --git a/nxcomp/RenderFreeGlyphSet.h b/nxcomp/src/RenderFreeGlyphSet.h
index 7233031ed..8817e8d99 100644
--- a/nxcomp/RenderFreeGlyphSet.h
+++ b/nxcomp/src/RenderFreeGlyphSet.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderFreeGlyphSet_H
diff --git a/nxcomp/RenderFreePicture.cpp b/nxcomp/src/RenderFreePicture.cpp
index b1074f33f..31662a7e2 100644
--- a/nxcomp/RenderFreePicture.cpp
+++ b/nxcomp/src/RenderFreePicture.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
//
// Include the template for
// this message class.
diff --git a/nxcomp/RenderFreePicture.h b/nxcomp/src/RenderFreePicture.h
index 2329cb4e5..b50191a72 100644
--- a/nxcomp/RenderFreePicture.h
+++ b/nxcomp/src/RenderFreePicture.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderFreePicture_H
diff --git a/nxcomp/RenderGenericRequest.cpp b/nxcomp/src/RenderGenericRequest.cpp
index 4f979c18f..cff34e61e 100644
--- a/nxcomp/RenderGenericRequest.cpp
+++ b/nxcomp/src/RenderGenericRequest.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "NXrender.h"
#include "RenderExtension.h"
diff --git a/nxcomp/RenderGenericRequest.h b/nxcomp/src/RenderGenericRequest.h
index 8fa3acb76..fdf5ca876 100644
--- a/nxcomp/RenderGenericRequest.h
+++ b/nxcomp/src/RenderGenericRequest.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderGenericRequest_H
diff --git a/nxcomp/RenderMinorExtensionHeaders.h b/nxcomp/src/RenderMinorExtensionHeaders.h
index dda0042d8..b7f6efc5a 100644
--- a/nxcomp/RenderMinorExtensionHeaders.h
+++ b/nxcomp/src/RenderMinorExtensionHeaders.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderMinorExtensionHeaders_H
diff --git a/nxcomp/RenderMinorExtensionMethods.h b/nxcomp/src/RenderMinorExtensionMethods.h
index 397f6966e..d272337e0 100644
--- a/nxcomp/RenderMinorExtensionMethods.h
+++ b/nxcomp/src/RenderMinorExtensionMethods.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
//
diff --git a/nxcomp/RenderMinorExtensionTags.h b/nxcomp/src/RenderMinorExtensionTags.h
index 1d61b103c..c24a99638 100644
--- a/nxcomp/RenderMinorExtensionTags.h
+++ b/nxcomp/src/RenderMinorExtensionTags.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderMinorExtensionTags_H
diff --git a/nxcomp/RenderPictureClip.cpp b/nxcomp/src/RenderPictureClip.cpp
index 7428e7219..0d6b505eb 100644
--- a/nxcomp/RenderPictureClip.cpp
+++ b/nxcomp/src/RenderPictureClip.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
//
// Include the template for
// this message class.
diff --git a/nxcomp/RenderPictureClip.h b/nxcomp/src/RenderPictureClip.h
index 35b320c31..bd811dfcd 100644
--- a/nxcomp/RenderPictureClip.h
+++ b/nxcomp/src/RenderPictureClip.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderPictureClip_H
diff --git a/nxcomp/RenderPictureFilter.cpp b/nxcomp/src/RenderPictureFilter.cpp
index b48fdca15..ce40e051a 100644
--- a/nxcomp/RenderPictureFilter.cpp
+++ b/nxcomp/src/RenderPictureFilter.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
//
// Include the template for
// this message class.
diff --git a/nxcomp/RenderPictureFilter.h b/nxcomp/src/RenderPictureFilter.h
index cf6ad5494..a3e37538b 100644
--- a/nxcomp/RenderPictureFilter.h
+++ b/nxcomp/src/RenderPictureFilter.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderPictureFilter_H
diff --git a/nxcomp/RenderPictureTransform.cpp b/nxcomp/src/RenderPictureTransform.cpp
index 048b73e6c..0048e61f4 100644
--- a/nxcomp/RenderPictureTransform.cpp
+++ b/nxcomp/src/RenderPictureTransform.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
//
// Include the template for
// this message class.
diff --git a/nxcomp/RenderPictureTransform.h b/nxcomp/src/RenderPictureTransform.h
index 061b6a3d8..649cd05d3 100644
--- a/nxcomp/RenderPictureTransform.h
+++ b/nxcomp/src/RenderPictureTransform.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderPictureTransform_H
diff --git a/nxcomp/RenderTrapezoids.cpp b/nxcomp/src/RenderTrapezoids.cpp
index 32fcd01c0..bf84509dc 100644
--- a/nxcomp/RenderTrapezoids.cpp
+++ b/nxcomp/src/RenderTrapezoids.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
//
// Include the template for
// this message class.
diff --git a/nxcomp/RenderTrapezoids.h b/nxcomp/src/RenderTrapezoids.h
index 3f3202016..faf524c76 100644
--- a/nxcomp/RenderTrapezoids.h
+++ b/nxcomp/src/RenderTrapezoids.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderTrapezoids_H
diff --git a/nxcomp/RenderTriangles.cpp b/nxcomp/src/RenderTriangles.cpp
index e98bf3506..a5eb4d83d 100644
--- a/nxcomp/RenderTriangles.cpp
+++ b/nxcomp/src/RenderTriangles.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
//
// Include the template for
// this message class.
diff --git a/nxcomp/RenderTriangles.h b/nxcomp/src/RenderTriangles.h
index 6c4d105a1..d73efb7b8 100644
--- a/nxcomp/RenderTriangles.h
+++ b/nxcomp/src/RenderTriangles.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef RenderTriangles_H
diff --git a/nxcomp/Rgb.cpp b/nxcomp/src/Rgb.cpp
index ad2e2fd92..c98fa5147 100644
--- a/nxcomp/Rgb.cpp
+++ b/nxcomp/src/Rgb.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Misc.h"
#include "Rgb.h"
diff --git a/nxcomp/Rgb.h b/nxcomp/src/Rgb.h
index 98ead38e3..ec088dd1b 100644
--- a/nxcomp/Rgb.h
+++ b/nxcomp/src/Rgb.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Rgb_H
diff --git a/nxcomp/Rle.cpp b/nxcomp/src/Rle.cpp
index b7b1460bd..2a145aa0c 100644
--- a/nxcomp/Rle.cpp
+++ b/nxcomp/src/Rle.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Misc.h"
#include "Rle.h"
diff --git a/nxcomp/Rle.h b/nxcomp/src/Rle.h
index 0e39fae5a..cc5dab0e8 100644
--- a/nxcomp/Rle.h
+++ b/nxcomp/src/Rle.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Rle_H
diff --git a/nxcomp/SendEvent.cpp b/nxcomp/src/SendEvent.cpp
index f65b1dbb2..8867d0a9e 100644
--- a/nxcomp/SendEvent.cpp
+++ b/nxcomp/src/SendEvent.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "SendEvent.h"
#include "ClientCache.h"
diff --git a/nxcomp/SendEvent.h b/nxcomp/src/SendEvent.h
index 9426180a4..a8841a706 100644
--- a/nxcomp/SendEvent.h
+++ b/nxcomp/src/SendEvent.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef SendEvent_H
diff --git a/nxcomp/SequenceQueue.cpp b/nxcomp/src/SequenceQueue.cpp
index ce044b1ff..a045875d7 100644
--- a/nxcomp/SequenceQueue.cpp
+++ b/nxcomp/src/SequenceQueue.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "SequenceQueue.h"
static const unsigned int INITIAL_SIZE_ = 16;
diff --git a/nxcomp/SequenceQueue.h b/nxcomp/src/SequenceQueue.h
index b243c4c9f..2a72bc3fe 100644
--- a/nxcomp/SequenceQueue.h
+++ b/nxcomp/src/SequenceQueue.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef SequenceQueue_H
diff --git a/nxcomp/ServerCache.cpp b/nxcomp/src/ServerCache.cpp
index f0cc6f825..c4c088dca 100644
--- a/nxcomp/ServerCache.cpp
+++ b/nxcomp/src/ServerCache.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ServerCache.h"
//
@@ -71,7 +83,6 @@ ServerCache::ServerCache() :
getKeyboardMappingKeysymCache(8),
getPropertyTypeCache(8),
- getPropertyTextCompressor(textCache, SERVER_TEXT_CACHE_SIZE),
getSelectionOwnerCache(8),
@@ -85,9 +96,7 @@ ServerCache::ServerCache() :
translateCoordsChildCache(8), translateCoordsXCache(8),
translateCoordsYCache(8),
- queryTreeWindowCache(8),
-
- getAtomNameTextCompressor(textCache, SERVER_TEXT_CACHE_SIZE)
+ queryTreeWindowCache(8)
{
unsigned int i;
diff --git a/nxcomp/ServerCache.h b/nxcomp/src/ServerCache.h
index ec213b89f..c6e2b81b6 100644
--- a/nxcomp/ServerCache.h
+++ b/nxcomp/src/ServerCache.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ServerCache_H
@@ -23,7 +31,6 @@
#include "IntCache.h"
#include "CharCache.h"
#include "OpcodeCache.h"
-#include "TextCompressor.h"
#include "BlockCache.h"
#include "BlockCacheSet.h"
@@ -47,7 +54,6 @@ class ServerCache : public ChannelCache
// General-purpose caches.
//
- CharCache textCache[SERVER_TEXT_CACHE_SIZE];
IntCache replySequenceCache;
IntCache eventSequenceCache;
unsigned int lastTimestamp;
@@ -215,7 +221,6 @@ class ServerCache : public ChannelCache
CharCache getPropertyFormatCache;
IntCache getPropertyTypeCache;
- TextCompressor getPropertyTextCompressor;
static BlockCache xResources;
//
@@ -273,13 +278,6 @@ class ServerCache : public ChannelCache
IntCache queryTreeWindowCache;
//
- // GetAtomName reply in protocol
- // versions >= 3.
- //
-
- TextCompressor getAtomNameTextCompressor;
-
- //
// Generic reply. Use short data
// in protocol versions >= 3.
//
diff --git a/nxcomp/ServerChannel.cpp b/nxcomp/src/ServerChannel.cpp
index 4e6dea324..0c99c9d33 100644
--- a/nxcomp/ServerChannel.cpp
+++ b/nxcomp/src/ServerChannel.cpp
@@ -1,24 +1,38 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
+#ifndef ANDROID
#include <sys/shm.h>
+#endif
#include <X11/X.h>
#include <X11/Xatom.h>
@@ -197,8 +211,6 @@ ServerChannel::ServerChannel(Transport *transport, StaticCompressor *compressor)
splitState_.load = 1;
splitState_.commit = 0;
- handleSplitEnable();
-
//
// It will be eventually set by
// the server proxy.
@@ -392,19 +404,6 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
priority_++;
- //
- // Due to the way the loop was implemented
- // we can't encode multiple messages if we
- // are encoding the first request.
- //
-
- if (control -> isProtoStep7() == 0)
- {
- if (proxy -> handleAsyncInit() < 0)
- {
- return -1;
- }
- }
}
else
{
@@ -502,13 +501,13 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
if (control -> LocalDeltaCompression == 0)
{
- int result = handleFastReadReply(encodeBuffer, requestOpcode,
+ int _result = handleFastReadReply(encodeBuffer, requestOpcode,
inputMessage, inputLength);
- if (result < 0)
+ if (_result < 0)
{
return -1;
}
- else if (result > 0)
+ else if (_result > 0)
{
continue;
}
@@ -543,19 +542,8 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
encodeBuffer.encodeValue(nameLength, 16, 6);
const unsigned char *nextSrc = inputMessage + 32;
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(nextSrc, nameLength);
- }
- else
- {
- serverCache_ -> getAtomNameTextCompressor.reset();
- for (unsigned int i = 0; i < nameLength; i++)
- {
- serverCache_ -> getAtomNameTextCompressor.
- encodeChar(*nextSrc++, encodeBuffer);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(nextSrc, nameLength);
priority_++;
}
@@ -802,9 +790,9 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
for (; numExtensions; numExtensions--)
{
- unsigned int length = (unsigned int) (*nextSrc++);
+ unsigned int _length = (unsigned int) (*nextSrc++);
- encodeBuffer.encodeValue(length, 8);
+ encodeBuffer.encodeValue(_length, 8);
#ifdef HIDE_MIT_SHM_EXTENSION
@@ -925,24 +913,13 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
const unsigned char* nextSrc = inputMessage + 32;
for (; numFonts; numFonts--)
{
- unsigned int length = (unsigned int) (*nextSrc++);
- encodeBuffer.encodeValue(length, 8);
+ unsigned int _length = (unsigned int) (*nextSrc++);
+ encodeBuffer.encodeValue(_length, 8);
- if (control -> isProtoStep7() == 1)
- {
- encodeBuffer.encodeTextData(nextSrc, length);
+ // Since ProtoStep7 (#issue 108)
+ encodeBuffer.encodeTextData(nextSrc, _length);
- nextSrc += length;
- }
- else
- {
- serverCache_ -> getPropertyTextCompressor.reset();
- for (; length; length--)
- {
- serverCache_ -> getPropertyTextCompressor.encodeChar(
- *nextSrc++, encodeBuffer);
- }
- }
+ nextSrc += _length;
}
priority_++;
@@ -986,13 +963,13 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
encodeBuffer.encodeBoolValue(1);
unsigned int numColors = ((inputLength - 32) >> 3);
- const unsigned char *nextSrc = inputMessage + 40;
+ const unsigned char *nextSrc1 = inputMessage + 40;
unsigned char *nextDest = (unsigned char *) inputMessage + 38;
for (unsigned int c = 1; c < numColors; c++)
{
for (unsigned int i = 0; i < 6; i++)
- *nextDest++ = *nextSrc++;
- nextSrc += 2;
+ *nextDest++ = *nextSrc1++;
+ nextSrc1 += 2;
}
unsigned int colorsLength = numColors * 6;
if (serverCache_ -> queryColorsLastReply.compare(colorsLength,
@@ -1000,13 +977,13 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
encodeBuffer.encodeBoolValue(1);
else
{
- const unsigned char *nextSrc = inputMessage + 32;
+ const unsigned char *nextSrc2 = inputMessage + 32;
encodeBuffer.encodeBoolValue(0);
encodeBuffer.encodeValue(numColors, 16, 5);
for (numColors *= 3; numColors; numColors--)
{
- encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16);
- nextSrc += 2;
+ encodeBuffer.encodeValue(GetUINT(nextSrc2, bigEndian_), 16);
+ nextSrc2 += 2;
}
}
@@ -1079,7 +1056,6 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
priority_++;
}
-
//
// Account this data to the original opcode.
//
@@ -1252,33 +1228,9 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29,
serverCache_ -> visualCache);
- if (control -> isProtoStep8() == 0)
- {
- unsigned int compressedDataSize = 0;
- unsigned char *compressedData = NULL;
-
- int compressed = handleCompress(encodeBuffer, requestOpcode, messageStore -> dataOffset,
- inputMessage, inputLength, compressedData,
- compressedDataSize);
- if (compressed < 0)
- {
- return -1;
- }
- else if (compressed > 0)
- {
- //
- // Update size according to result of image compression.
- //
-
- handleUpdate(messageStore, inputLength - messageStore ->
- dataOffset, compressedDataSize);
- }
- }
- else
- {
- handleCopy(encodeBuffer, requestOpcode, messageStore ->
- dataOffset, inputMessage, inputLength);
- }
+ // Since ProtoStep8 (#issue 108)
+ handleCopy(encodeBuffer, requestOpcode, messageStore ->
+ dataOffset, inputMessage, inputLength);
priority_++;
}
@@ -1347,13 +1299,13 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
if (control -> LocalDeltaCompression == 0)
{
- int result = handleFastReadReply(encodeBuffer, requestOpcode,
+ int _result = handleFastReadReply(encodeBuffer, requestOpcode,
inputMessage, inputLength);
- if (result < 0)
+ if (_result < 0)
{
return -1;
}
- else if (result > 0)
+ else if (_result > 0)
{
continue;
}
@@ -1500,7 +1452,6 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
continue;
}
}
-
//
// Check if user pressed the CTRL+ALT+SHIFT+ESC key
// sequence because was unable to kill the session
@@ -1571,13 +1522,13 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
if (control -> LocalDeltaCompression == 0)
{
- int result = handleFastReadEvent(encodeBuffer, inputOpcode,
+ int _result = handleFastReadEvent(encodeBuffer, inputOpcode,
inputMessage, inputLength);
- if (result < 0)
+ if (_result < 0)
{
return -1;
}
- else if (result > 0)
+ else if (_result > 0)
{
continue;
}
@@ -1669,10 +1620,10 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
serverCache_ -> buttonCache);
else
encodeBuffer.encodeValue((unsigned int) detail, 8);
- unsigned int timestamp = GetULONG(inputMessage + 4, bigEndian_);
+ unsigned int _timestamp = GetULONG(inputMessage + 4, bigEndian_);
unsigned int timestampDiff =
- timestamp - serverCache_ -> lastTimestamp;
- serverCache_ -> lastTimestamp = timestamp;
+ _timestamp - serverCache_ -> lastTimestamp;
+ serverCache_ -> lastTimestamp = _timestamp;
encodeBuffer.encodeCachedValue(timestampDiff, 32,
serverCache_ -> motionNotifyTimestampCache, 9);
int skipRest = 0;
@@ -1844,10 +1795,10 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
29, serverCache_ -> propertyNotifyWindowCache, 9);
encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_),
29, serverCache_ -> propertyNotifyAtomCache, 9);
- unsigned int timestamp = GetULONG(inputMessage + 12, bigEndian_);
+ unsigned int _timestamp = GetULONG(inputMessage + 12, bigEndian_);
unsigned int timestampDiff =
- timestamp - serverCache_ -> lastTimestamp;
- serverCache_ -> lastTimestamp = timestamp;
+ _timestamp - serverCache_ -> lastTimestamp;
+ serverCache_ -> lastTimestamp = _timestamp;
encodeBuffer.encodeValue(timestampDiff, 32, 9);
encodeBuffer.encodeBoolValue((unsigned int) inputMessage[16]);
}
@@ -1868,9 +1819,9 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
break;
case SelectionClear:
{
- unsigned int timestamp = GetULONG(inputMessage + 4, bigEndian_);
- unsigned int timestampDiff = timestamp - serverCache_ -> lastTimestamp;
- serverCache_ -> lastTimestamp = timestamp;
+ unsigned int _timestamp = GetULONG(inputMessage + 4, bigEndian_);
+ unsigned int timestampDiff = _timestamp - serverCache_ -> lastTimestamp;
+ serverCache_ -> lastTimestamp = _timestamp;
encodeBuffer.encodeValue(timestampDiff, 32, 9);
encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_),
29, serverCache_ -> selectionClearWindowCache, 9);
@@ -1880,9 +1831,9 @@ int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *m
break;
case SelectionRequest:
{
- unsigned int timestamp = GetULONG(inputMessage + 4, bigEndian_);
- unsigned int timestampDiff = timestamp - serverCache_ -> lastTimestamp;
- serverCache_ -> lastTimestamp = timestamp;
+ unsigned int _timestamp = GetULONG(inputMessage + 4, bigEndian_);
+ unsigned int timestampDiff = _timestamp - serverCache_ -> lastTimestamp;
+ serverCache_ -> lastTimestamp = _timestamp;
encodeBuffer.encodeValue(timestampDiff, 32, 9);
encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_),
29, serverCache_ -> selectionClearWindowCache, 9);
@@ -2069,10 +2020,8 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
// encoding is used.
//
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeValue(length, 8);
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeValue(length, 8);
unsigned int nextByte;
unsigned char *outputMessage = writeBuffer_.addMessage(length);
@@ -2285,19 +2234,8 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
if (format == 8)
{
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(nextDest, dataLength);
- }
- else
- {
- clientCache_ -> changePropertyTextCompressor.reset();
- for (unsigned int i = 0; i < dataLength; i++)
- {
- *nextDest++ = clientCache_ -> changePropertyTextCompressor.
- decodeChar(decodeBuffer);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(nextDest, dataLength);
}
else if (format == 32)
{
@@ -2584,16 +2522,10 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
outputMessage = writeBuffer_.addMessage(outputLength);
writeBuffer_.registerPointer(&outputMessage);
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeNewXidValue(value, clientCache_ -> lastId,
- clientCache_ -> lastIdCache, clientCache_ -> gcCache,
- clientCache_ -> freeGCCache);
- }
- else
- {
- decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache);
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeNewXidValue(value, clientCache_ -> lastId,
+ clientCache_ -> lastIdCache, clientCache_ -> gcCache,
+ clientCache_ -> freeGCCache);
PutULONG(value, outputMessage + 4, bigEndian_);
unsigned int offset = 8;
@@ -2688,16 +2620,10 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache);
PutULONG(value, outputMessage + 8, bigEndian_);
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeNewXidValue(value, clientCache_ -> lastId,
- clientCache_ -> lastIdCache, clientCache_ -> windowCache,
- clientCache_ -> freeWindowCache);
- }
- else
- {
- decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache);
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeNewXidValue(value, clientCache_ -> lastId,
+ clientCache_ -> lastIdCache, clientCache_ -> windowCache,
+ clientCache_ -> freeWindowCache);
PutULONG(value, outputMessage + 4, bigEndian_);
unsigned char *nextDest = outputMessage + 12;
@@ -2754,16 +2680,9 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
unsigned int numPoints;
- if (control -> isProtoStep10() == 1)
- {
- decodeBuffer.decodeCachedValue(numPoints, 16,
- clientCache_ -> fillPolyNumPointsCache, 4);
- }
- else
- {
- decodeBuffer.decodeCachedValue(numPoints, 14,
- clientCache_ -> fillPolyNumPointsCache, 4);
- }
+ // Since ProtoStep10 (#issue 108)
+ decodeBuffer.decodeCachedValue(numPoints, 16,
+ clientCache_ -> fillPolyNumPointsCache, 4);
outputLength = 16 + (numPoints << 2);
outputMessage = writeBuffer_.addMessage(outputLength);
@@ -2859,14 +2778,8 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
outputLength = 8;
outputMessage = writeBuffer_.addMessage(outputLength);
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeGCCache);
- }
- else
- {
- decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache);
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeGCCache);
PutULONG(value, outputMessage + 4, bigEndian_);
}
@@ -2876,23 +2789,10 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
outputLength = 8;
outputMessage = writeBuffer_.addMessage(outputLength);
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeDrawableCache);
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeDrawableCache);
- PutULONG(value, outputMessage + 4, bigEndian_);
- }
- else
- {
- decodeBuffer.decodeBoolValue(value);
- if (!value)
- {
- decodeBuffer.decodeValue(value, 29, 4);
- clientCache_ -> createPixmapLastId += value;
- clientCache_ -> createPixmapLastId &= 0x1fffffff;
- }
- PutULONG(clientCache_ -> createPixmapLastId, outputMessage + 4, bigEndian_);
- }
+ PutULONG(value, outputMessage + 4, bigEndian_);
}
break;
case X_GetAtomName:
@@ -3125,21 +3025,10 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
clientCache_ -> polyTextDeltaCache);
*nextDest++ = cValue;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(nextDest, textLength);
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(nextDest, textLength);
- nextDest += textLength;
- }
- else
- {
- clientCache_ -> polyTextTextCompressor.reset();
- while (textLength)
- {
- *nextDest++ = clientCache_ -> polyTextTextCompressor.decodeChar(decodeBuffer);
- textLength--;
- }
- }
+ nextDest += textLength;
}
}
outputLength += addedLength;
@@ -3211,23 +3100,10 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> polyTextDeltaCache);
*nextDest++ = cValue;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(nextDest, textLength * 2);
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(nextDest, textLength * 2);
- nextDest += textLength * 2;
- }
- else
- {
- clientCache_ -> polyTextTextCompressor.reset();
- textLength <<= 1;
- while (textLength)
- {
- *nextDest++ =
- clientCache_ -> polyTextTextCompressor.decodeChar(decodeBuffer);
- textLength--;
- }
- }
+ nextDest += textLength * 2;
}
}
outputLength += addedLength;
@@ -3279,16 +3155,8 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
PutUINT(clientCache_ -> imageTextLastY, outputMessage + 14, bigEndian_);
unsigned char *nextDest = outputMessage + 16;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(nextDest, textLength);
- }
- else
- {
- clientCache_ -> imageTextTextCompressor.reset();
- for (unsigned int j = 0; j < textLength; j++)
- *nextDest++ = clientCache_ -> imageTextTextCompressor.decodeChar(decodeBuffer);
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(nextDest, textLength);
handleSave(messageStore, outputMessage, outputLength);
}
@@ -3326,16 +3194,8 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
PutUINT(clientCache_ -> imageTextLastY, outputMessage + 14, bigEndian_);
unsigned char *nextDest = outputMessage + 16;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(nextDest, textLength * 2);
- }
- else
- {
- clientCache_ -> imageTextTextCompressor.reset();
- for (unsigned int j = 0; j < textLength * 2; j++)
- *nextDest++ = clientCache_ -> imageTextTextCompressor.decodeChar(decodeBuffer);
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(nextDest, textLength * 2);
handleSave(messageStore, outputMessage, outputLength);
}
@@ -3362,18 +3222,8 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
outputMessage[1] = (unsigned char) value;
unsigned char *nextDest = outputMessage + 8;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(nextDest, nameLength);
- }
- else
- {
- clientCache_ -> internAtomTextCompressor.reset();
- for (unsigned int i = 0; i < nameLength; i++)
- {
- *nextDest++ = clientCache_ -> internAtomTextCompressor.decodeChar(decodeBuffer);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(nextDest, nameLength);
sequenceQueue_.push(clientSequence_, outputOpcode);
@@ -3399,18 +3249,8 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
PutUINT(value, outputMessage + 4, bigEndian_);
unsigned char* nextDest = outputMessage + 8;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(nextDest, textLength);
- }
- else
- {
- clientCache_ -> polyTextTextCompressor.reset();
- for (unsigned int i = 0; i < textLength; i++)
- {
- *nextDest++ = clientCache_ -> polyTextTextCompressor.decodeChar(decodeBuffer);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(nextDest, textLength);
sequenceQueue_.push(clientSequence_, outputOpcode);
}
@@ -3428,18 +3268,8 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
PutUINT(textLength, outputMessage + 8, bigEndian_);
unsigned char *nextDest = outputMessage + 12;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(nextDest, textLength);
- }
- else
- {
- clientCache_ -> polyTextTextCompressor.reset();
- for (unsigned int i = 0; i < textLength; i++)
- {
- *nextDest++ = clientCache_ -> polyTextTextCompressor.decodeChar(decodeBuffer);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(nextDest, textLength);
sequenceQueue_.push(clientSequence_, outputOpcode);
}
@@ -3456,7 +3286,7 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
outputLength = 8;
outputMessage = writeBuffer_.addMessage(outputLength);
- if (outputOpcode == X_DestroyWindow && control -> isProtoStep7() == 1)
+ if (outputOpcode == X_DestroyWindow) // Since ProtoStep7 (#issue 108)
{
decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeWindowCache);
}
@@ -3487,19 +3317,8 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
PutULONG(clientCache_ -> lastFont, outputMessage + 4, bigEndian_);
unsigned char *nextDest = outputMessage + 12;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeTextData(nextDest, nameLength);
- }
- else
- {
- clientCache_ -> openFontTextCompressor.reset();
- for (; nameLength; nameLength--)
- {
- *nextDest++ = clientCache_ -> openFontTextCompressor.
- decodeChar(decodeBuffer);
- }
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeTextData(nextDest, nameLength);
}
break;
case X_PolyFillRectangle:
@@ -4137,14 +3956,8 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
unsigned int numRectangles;
- if (control -> isProtoStep9() == 1)
- {
- decodeBuffer.decodeValue(numRectangles, 15, 4);
- }
- else
- {
- decodeBuffer.decodeValue(numRectangles, 13, 4);
- }
+ // Since ProtoStep9 (#issue 108)
+ decodeBuffer.decodeValue(numRectangles, 15, 4);
outputLength = (numRectangles << 3) + 12;
outputMessage = writeBuffer_.addMessage(outputLength);
@@ -4573,6 +4386,24 @@ int ServerChannel::handleWrite(const unsigned char *message, unsigned int length
} // End of switch on opcode.
//
+ // TODO: at the moment the variable hit was being set
+ // but not used, so to avoid the corresponding warning
+ // this logging block has been added.
+ // This code will probably be optimized away when none
+ // of the defines is set, but if there is no additional
+ // use for the hit variable in the future, then maybe
+ // it could be removed completely.
+ //
+
+ if (hit)
+ {
+ #if defined(TEST) || defined(OPCODES)
+ *logofs << "handleWrite: Cached flag enabled in handled request.\n"
+ << logofs_flush;
+ #endif
+ }
+
+ //
// A packed image request can generate more than just
// a single X_PutImage. Write buffer is handled inside
// handleUnpack(). Cannot simply assume that the final
@@ -4669,10 +4500,8 @@ int ServerChannel::handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store,
T_store_action action, int position, unsigned char &opcode,
unsigned char *&buffer, unsigned int &size)
{
- if (control -> isProtoStep7() == 1)
- {
- splitState_.current = splitState_.resource;
- }
+ // Since ProtoStep7 (#issue 108)
+ splitState_.current = splitState_.resource;
handleSplitStoreAlloc(&splitResources_, splitState_.current);
@@ -4707,14 +4536,12 @@ int ServerChannel::handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store,
action, checksum, buffer, size);
//
- // If we are connected to an old proxy
- // version or the encoding side didn't
- // provide a checksum, then don't send
- // the split report.
+ // If the encoding side didn't provide
+ // a checksum, then don't send the split
+ // report.
//
- if (control -> isProtoStep7() == 0 ||
- checksum == NULL)
+ if (checksum == NULL)
{
if (action == IS_HIT)
{
@@ -4736,8 +4563,6 @@ int ServerChannel::handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store,
#endif
- delete [] checksum;
-
return 1;
}
@@ -4803,7 +4628,7 @@ int ServerChannel::handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store,
#if defined(TEST) || defined(SPLIT)
*logofs << "handleSplit: SPLIT! Spent "
- << diffTimestamp(startTs, getTimestamp()) << " Ms "
+ << diffTimestamp(startTs, getTimestamp()) << " ms "
<< "handling abort split events for FD#" << fd_
<< ".\n" << logofs_flush;
@@ -4829,13 +4654,11 @@ int ServerChannel::handleSplit(DecodeBuffer &decodeBuffer)
unsigned char resource;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeCachedValue(resource, 8,
- clientCache_ -> resourceCache);
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeCachedValue(resource, 8,
+ clientCache_ -> resourceCache);
- splitState_.current = resource;
- }
+ splitState_.current = resource;
handleSplitStoreAlloc(&splitResources_, splitState_.current);
@@ -4967,7 +4790,7 @@ int ServerChannel::handleSplit(DecodeBuffer &decodeBuffer)
#if defined(TEST) || defined(SPLIT)
*logofs << "handleSplit: WARNING! SPLIT! Spent "
- << diffTimestamp(startTs, getTimestamp()) << " Ms "
+ << diffTimestamp(startTs, getTimestamp()) << " ms "
<< "handling asynchronous abort split events for "
<< "FD#" << fd_ << ".\n" << logofs_flush;
@@ -5391,8 +5214,11 @@ int ServerChannel::handleColormap(unsigned char &opcode, unsigned char *&buffer,
// data in compressed form.
//
- if (control -> isProtoStep7() == 1)
- {
+ //
+ // Since ProtoStep7 (#issue 108)
+ //
+
+ { // An anonymous block is used here to limit the scope of local variables
unsigned int packed = GetULONG(buffer + 8, bigEndian_);
unsigned int unpacked = GetULONG(buffer + 12, bigEndian_);
@@ -5475,7 +5301,7 @@ int ServerChannel::handleColormap(unsigned char &opcode, unsigned char *&buffer,
*logofs << "handleColormap: Dumping colormap entries:\n"
<< logofs_flush;
- const unsigned char *p = unpackState_[resource] -> colormap -> data;
+ const unsigned char *p = (const unsigned char *) unpackState_[resource] -> colormap -> data;
for (unsigned int i = 0; i < unpackState_[resource] ->
colormap -> entries; i++)
@@ -5486,85 +5312,7 @@ int ServerChannel::handleColormap(unsigned char &opcode, unsigned char *&buffer,
}
#endif
- }
- else
- {
- unsigned int entries = GetULONG(buffer + 4, bigEndian_);
-
- if (size == entries * 4 + 8)
- {
- if (unpackState_[resource] -> colormap -> entries != entries &&
- unpackState_[resource] -> colormap -> data != NULL)
- {
- #ifdef TEST
- *logofs << "handleColormap: Freeing previously "
- << "allocated unpack colormap.\n"
- << logofs_flush;
- #endif
-
- delete [] unpackState_[resource] -> colormap -> data;
-
- unpackState_[resource] -> colormap -> data = NULL;
- unpackState_[resource] -> colormap -> entries = 0;
- }
-
- if (entries > 0)
- {
- if (unpackState_[resource] -> colormap -> data == NULL)
- {
- unpackState_[resource] ->
- colormap -> data = new unsigned int[entries];
- }
-
- if (unpackState_[resource] -> colormap -> data != NULL)
- {
- unpackState_[resource] -> colormap -> entries = entries;
-
- #ifdef DEBUG
- *logofs << "handleColormap: Size of new colormap "
- << "data is " << (entries << 2) << ".\n"
- << logofs_flush;
- #endif
-
- memcpy((unsigned char *) unpackState_[resource] ->
- colormap -> data, buffer + 8, entries << 2);
-
- #if defined(DEBUG) && defined(DUMP)
-
- *logofs << "handleColormap: Dumping colormap entries:\n"
- << logofs_flush;
-
- const unsigned int *p = (unsigned int *) buffer + 8;
-
- for (unsigned int i = 0; i < entries; i++)
- {
- *logofs << "handleColormap: [" << i << "] ["
- << (void *) p[i] << "].\n"
- << logofs_flush;
- }
-
- #endif
- }
- else
- {
- #ifdef PANIC
- *logofs << "handleColormap: PANIC! Can't allocate "
- << entries << " entries for unpack colormap "
- << "for FD#" << fd_ << ".\n" << logofs_flush;
- #endif
- }
- }
- }
- else
- {
- #ifdef PANIC
- *logofs << "handleColormap: PANIC! Bad size " << size
- << " for set unpack colormap message for FD#"
- << fd_ << " with " << entries << " entries.\n"
- << logofs_flush;
- #endif
- }
- }
+ } // end anonymous block
handleColormapEnd:
@@ -5593,8 +5341,11 @@ int ServerChannel::handleAlpha(unsigned char &opcode, unsigned char *&buffer,
// data in compressed form.
//
- if (control -> isProtoStep7() == 1)
- {
+ //
+ // Since ProtoStep7 (#issue 108)
+ //
+
+ { // An anonymous block is used here to limit the scope of local variables
unsigned int packed = GetULONG(buffer + 8, bigEndian_);
unsigned int unpacked = GetULONG(buffer + 12, bigEndian_);
@@ -5687,82 +5438,7 @@ int ServerChannel::handleAlpha(unsigned char &opcode, unsigned char *&buffer,
}
#endif
- }
- else
- {
- unsigned int entries = GetULONG(buffer + 4, bigEndian_);
-
- if (size == RoundUp4(entries) + 8)
- {
- if (unpackState_[resource] -> alpha -> entries != entries &&
- unpackState_[resource] -> alpha -> data != NULL)
- {
- #ifdef TEST
- *logofs << "handleAlpha: Freeing previously allocated "
- << "unpack alpha data.\n" << logofs_flush;
- #endif
-
- delete [] unpackState_[resource] -> alpha -> data;
-
- unpackState_[resource] -> alpha -> data = NULL;
- unpackState_[resource] -> alpha -> entries = 0;
- }
-
- if (entries > 0)
- {
- if (unpackState_[resource] -> alpha -> data == NULL)
- {
- unpackState_[resource] -> alpha -> data = new unsigned char[entries];
- }
-
- if (unpackState_[resource] -> alpha -> data != NULL)
- {
- unpackState_[resource] -> alpha -> entries = entries;
-
- #ifdef DEBUG
- *logofs << "handleAlpha: Size of new alpha data is "
- << entries << ".\n" << logofs_flush;
- #endif
-
- memcpy((unsigned char *) unpackState_[resource] ->
- alpha -> data, buffer + 8, entries);
-
- #if defined(DEBUG) && defined(DUMP)
-
- *logofs << "handleAlpha: Dumping alpha entries:\n"
- << logofs_flush;
-
- const unsigned char *p = buffer + 8;
-
- for (unsigned int i = 0; i < entries; i++)
- {
- *logofs << "handleAlpha: [" << i << "] ["
- << (void *) ((int) p[i]) << "].\n"
- << logofs_flush;
- }
-
- #endif
- }
- else
- {
- #ifdef PANIC
- *logofs << "handleAlpha: PANIC! Can't allocate "
- << entries << " entries for unpack alpha data "
- << "for FD#" << fd_ << ".\n" << logofs_flush;
- #endif
- }
- }
- }
- #ifdef PANIC
- else
- {
- *logofs << "handleAlpha: PANIC! Bad size " << size
- << " for set unpack alpha message for FD#"
- << fd_ << " with " << entries << " entries.\n"
- << logofs_flush;
- }
- #endif
- }
+ } //end anonymous block
handleAlphaEnd:
@@ -5993,9 +5669,9 @@ int ServerChannel::handleMotion(EncodeBuffer &encodeBuffer)
serverCache_ -> buttonCache);
else
encodeBuffer.encodeValue((unsigned int) detail, 8);
- unsigned int timestamp = GetULONG(buffer + 4, bigEndian_);
- unsigned int timestampDiff = timestamp - serverCache_ -> lastTimestamp;
- serverCache_ -> lastTimestamp = timestamp;
+ unsigned int _timestamp = GetULONG(buffer + 4, bigEndian_);
+ unsigned int timestampDiff = _timestamp - serverCache_ -> lastTimestamp;
+ serverCache_ -> lastTimestamp = _timestamp;
encodeBuffer.encodeCachedValue(timestampDiff, 32,
serverCache_ -> motionNotifyTimestampCache, 9);
int skipRest = 0;
@@ -6159,7 +5835,7 @@ int ServerChannel::handleAsyncEvents()
#if defined(TEST) || defined(INFO)
*logofs << "handleAsyncEvents: Spent " << diffTimestamp(startTs,
- getTimestamp()) << " Ms handling events for FD#"
+ getTimestamp()) << " ms handling events for FD#"
<< fd_ << ".\n" << logofs_flush;
#endif
@@ -6680,15 +6356,20 @@ int ServerChannel::handleFastWriteRequest(DecodeBuffer &decodeBuffer, unsigned c
{
//
// All the NX requests are handled in the
- // main message loop. The X_PutImage can
- // be handled here only if a split was
- // not requested.
+ // main message loop.
+ //
+
+ //
+ // Since ProtoStep7 (#issue 108)
+ //
+ // The X_PutImage can be handled here only
+ // if a split was not requested.
//
if ((opcode >= X_NXFirstOpcode && opcode <= X_NXLastOpcode) ||
- (control -> isProtoStep7() == 1 && opcode == X_PutImage &&
- splitState_.resource != nothing) || opcode == X_ListExtensions ||
- opcode == X_QueryExtension)
+ (opcode == X_PutImage && splitState_.resource != nothing) ||
+ opcode == X_ListExtensions ||
+ opcode == X_QueryExtension)
{
return 0;
}
@@ -7100,7 +6781,12 @@ int ServerChannel::handleShmemReply(EncodeBuffer &encodeBuffer, const unsigned c
{
encodeBuffer.encodeValue(stage, 2);
+#ifndef ANDROID
shmemState_ -> present = *(buffer + 8);
+#else
+ shmemState_ -> present = 0;
+ cerr << "Info: handleShmemReply: In android no shared memory. Setting present to 0 hardcoded\n";
+#endif
shmemState_ -> opcode = *(buffer + 9);
shmemState_ -> event = *(buffer + 10);
shmemState_ -> error = *(buffer + 11);
@@ -7128,7 +6814,12 @@ int ServerChannel::handleShmemReply(EncodeBuffer &encodeBuffer, const unsigned c
cerr << "Info" << ": Using shared memory parameters 1/"
<< (shmemState_ -> size / 1024) << "K.\n";
+#ifndef ANDROID
shmemState_ -> enabled = 1;
+#else
+ cerr << "Info: handleShmemReply: In android no shared memory. Setting enabled to -1. This should not be displayed\n";
+ shmemState_ -> enabled = -1;
+#endif
encodeBuffer.encodeBoolValue(1);
}
@@ -7241,7 +6932,7 @@ int ServerChannel::handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char
// memory support is disabled by the
// user.
//
-
+#ifndef ANDROID
if (control -> ShmemServer == 1 &&
control -> ShmemServerSize > 0 &&
enableServer == 1)
@@ -7252,8 +6943,12 @@ int ServerChannel::handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char
{
memcpy(buffer + 8, "NO-MIT-", 7);
}
+#else
+ cerr << "Info: handleShmemRequest: In android no shared memory. Returning NO-MIT- answer\n";
- sequenceQueue_.push(clientSequence_, opcode,
+ memcpy(buffer + 8, "NO-MIT-", 7);
+#endif
+ sequenceQueue_.push(clientSequence_, opcode,
opcodeStore_ -> getShmemParameters, stage);
//
@@ -7289,9 +6984,13 @@ int ServerChannel::handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char
shmemState_ -> size = control -> ShmemServerSize;
+#ifndef ANDROID
shmemState_ -> id = shmget(IPC_PRIVATE, shmemState_ -> size,
IPC_CREAT | permissions);
-
+#else
+ cerr << "Info: handleShmemReqyest: In android no shared memory (shmget). This message should not be displayed present should never be 1 in android\n";
+ shmemState_ -> id = -1;
+#endif
if (shmemState_ -> id >= 0)
{
#if defined(TEST) || defined(INFO)
@@ -7302,8 +7001,12 @@ int ServerChannel::handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char
#endif
+#ifndef ANDROID
shmemState_ -> address = shmat(shmemState_ -> id, 0, 0);
-
+#else
+ cerr << "Info: handleShmemReqyest: In android no shared memory (shmat). This message should not be displayed. present should never be 1 in android\n";
+ shmemState_ -> address = NULL;
+#endif
if (shmemState_ -> address != NULL)
{
#ifdef TEST
@@ -7437,6 +7140,10 @@ int ServerChannel::handleShmem(unsigned char &opcode, unsigned char *&buffer,
return 0;
}
+#ifdef ANDROID
+ cerr << "Info: handleShmem: In android no shared memory. enabled should never be 1. This should not be displayed\n";
+ return 0;
+#endif
//
// Ignore null requests and requests that will not result
@@ -7561,7 +7268,7 @@ int ServerChannel::handleShmem(unsigned char &opcode, unsigned char *&buffer,
#if defined(TEST) || defined(INFO)
*logofs << "handleShmem: WARNING! Missing completion "
<< "after " << diffTimestamp(shmemState_ -> last,
- getTimestamp()) << " Ms for shared memory "
+ getTimestamp()) << " ms for shared memory "
<< "for FD#" << fd_ << ".\n" << logofs_flush;
#endif
@@ -7695,7 +7402,7 @@ int ServerChannel::handleShmemEvent()
{
#if defined(TEST) || defined(INFO)
*logofs << "handleShmemEvent: Spent "
- << diffTimestamp(startTs, getTimestamp()) << " Ms "
+ << diffTimestamp(startTs, getTimestamp()) << " ms "
<< "waiting for shared memory sequence for FD#"
<< fd_ << ".\n" << logofs_flush;
#endif
@@ -7707,7 +7414,7 @@ int ServerChannel::handleShmemEvent()
*logofs << "handleShmemEvent: WARNING! Can't reset shared "
<< "memory sequence for FD#" << fd_ << " after "
<< diffTimestamp(shmemState_ -> last, getTimestamp())
- << " Ms.\n" << logofs_flush;
+ << " ms.\n" << logofs_flush;
#endif
return 0;
@@ -7723,7 +7430,7 @@ int ServerChannel::checkShmemEvent(unsigned char event, unsigned short sequence,
*logofs << "checkShmemEvent: Reset shared memory sequence "
<< shmemState_ -> sequence << " for FD#" << fd_
<< " after " << diffTimestamp(shmemState_ -> last,
- getTimestamp()) << " Ms.\n" << logofs_flush;
+ getTimestamp()) << " ms.\n" << logofs_flush;
#endif
shmemState_ -> sequence = 0;
@@ -7870,14 +7577,6 @@ int ServerChannel::handleCacheRequest(DecodeBuffer &decodeBuffer, unsigned char
splitState_.save = (mask >> 8) & 0xff;
splitState_.load = mask & 0xff;
- //
- // Just to be sure. We should never
- // receive this request if connected
- // to an old proxy version.
- //
-
- handleSplitEnable();
-
#ifdef TEST
*logofs << "handleCacheRequest: Set cache parameters to "
<< "save " << splitState_.save << " load "
@@ -7894,34 +7593,24 @@ int ServerChannel::handleStartSplitRequest(DecodeBuffer &decodeBuffer, unsigned
{
//
// Prepare for the split for the selected
- // resource. Old proxy versions only use
+ // resource. Old proxy versions only used
// the split store at position 0.
//
- if (control -> isProtoStep7() == 1)
- {
- unsigned char resource;
+ // Since ProtoStep7 (#issue 108)
+ unsigned char resource;
- decodeBuffer.decodeCachedValue(resource, 8,
- clientCache_ -> resourceCache);
+ decodeBuffer.decodeCachedValue(resource, 8,
+ clientCache_ -> resourceCache);
- splitState_.resource = resource;
+ splitState_.resource = resource;
- splitState_.current = splitState_.resource;
+ splitState_.current = splitState_.resource;
- #if defined(TEST) || defined(SPLIT)
- *logofs << "handleStartSplitRequest: SPLIT! Registered id "
- << splitState_.resource << " as resource "
- << "waiting for a split.\n" << logofs_flush;
- #endif
- }
#if defined(TEST) || defined(SPLIT)
- else
- {
- *logofs << "handleStartSplitRequest: SPLIT! Assuming fake id "
- << splitState_.current << " as resource "
- << "waiting for a split.\n" << logofs_flush;
- }
+ *logofs << "handleStartSplitRequest: SPLIT! Registered id "
+ << splitState_.resource << " as resource "
+ << "waiting for a split.\n" << logofs_flush;
#endif
handleNullRequest(opcode, buffer, size);
@@ -7936,40 +7625,38 @@ int ServerChannel::handleEndSplitRequest(DecodeBuffer &decodeBuffer, unsigned ch
// Verify that the agent resource matches.
//
- if (control -> isProtoStep7() == 1)
- {
- unsigned char resource;
-
- decodeBuffer.decodeCachedValue(resource, 8,
- clientCache_ -> resourceCache);
-
- #ifdef TEST
+ // Since ProtoStep7 (#issue 108)
+ unsigned char resource;
- if (splitState_.resource == nothing)
- {
- #ifdef PANIC
- *logofs << "handleEndSplitRequest: PANIC! SPLIT! Received an end of "
- << "split for resource id " << (unsigned int) *(buffer + 1)
- << " without a previous start.\n"
- << logofs_flush;
- #endif
+ decodeBuffer.decodeCachedValue(resource, 8,
+ clientCache_ -> resourceCache);
- HandleCleanup();
- }
- else if (resource != splitState_.resource)
- {
- #ifdef PANIC
- *logofs << "handleEndSplitRequest: PANIC! SPLIT! Invalid resource id "
- << resource << " received while waiting for resource id "
- << splitState_.resource << ".\n" << logofs_flush;
- #endif
+ #ifdef TEST
- HandleCleanup();
- }
+ if (splitState_.resource == nothing)
+ {
+ #ifdef PANIC
+ *logofs << "handleEndSplitRequest: PANIC! SPLIT! Received an end of "
+ << "split for resource id " << (unsigned int) *(buffer + 1)
+ << " without a previous start.\n"
+ << logofs_flush;
+ #endif
+ HandleCleanup();
+ }
+ else if (resource != splitState_.resource)
+ {
+ #ifdef PANIC
+ *logofs << "handleEndSplitRequest: PANIC! SPLIT! Invalid resource id "
+ << resource << " received while waiting for resource id "
+ << splitState_.resource << ".\n" << logofs_flush;
#endif
+
+ HandleCleanup();
}
+ #endif
+
#if defined(TEST) || defined(SPLIT)
*logofs << "handleEndSplitRequest: SPLIT! Reset id "
<< splitState_.resource << " as resource "
@@ -7987,15 +7674,8 @@ int ServerChannel::handleSplitChecksum(DecodeBuffer &decodeBuffer, T_checksum &c
{
unsigned int receive;
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeBoolValue(receive);
- }
- else
- {
- receive = (control -> ImageCacheEnableLoad == 1 ||
- control -> ImageCacheEnableSave == 1);
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeBoolValue(receive);
if (receive == 1)
{
@@ -8054,14 +7734,22 @@ void ServerChannel::handleShmemStateRemove()
{
if (shmemState_ != NULL)
{
- if (shmemState_ -> address != NULL)
+ if (shmemState_ -> address != NULL)
{
- shmdt((char *) shmemState_ -> address);
+#ifndef ANDROID
+ shmdt((char *) shmemState_ -> address);
+#else
+ cerr << "Info: handleShmemStateRemove: In android no shared memory. This should not be displayed. address should always be NULL\n";
+#endif
}
if (shmemState_ -> id > 0)
{
+#ifndef ANDROID
shmctl(shmemState_ -> id, IPC_RMID, 0);
+#else
+ cerr << "Info: handleShmemStateRemove: In android no shared memory. This should not be displayed. id should always be 0\n";
+#endif
}
delete shmemState_;
@@ -8222,11 +7910,11 @@ void ServerChannel::handleEncodeCharInfo(const unsigned char *nextSrc, EncodeBuf
for (unsigned int i = 1; i < 5; i++)
{
- unsigned int value = GetUINT(nextSrc, bigEndian_);
+ unsigned int _value = GetUINT(nextSrc, bigEndian_);
nextSrc += 2;
- encodeBuffer.encodeCachedValue(value, 16,
+ encodeBuffer.encodeCachedValue(_value, 16,
*serverCache_ -> queryFontCharInfoCache[i], 6);
}
}
diff --git a/nxcomp/ServerChannel.h b/nxcomp/src/ServerChannel.h
index 6536db829..374e52896 100644
--- a/nxcomp/ServerChannel.h
+++ b/nxcomp/src/ServerChannel.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ServerChannel_H
@@ -312,21 +320,6 @@ class ServerChannel : public Channel
int handleSplitChecksum(DecodeBuffer &decodeBuffer, T_checksum &checksum);
- void handleSplitEnable()
- {
- if (control -> isProtoStep7() == 0)
- {
- #if defined(TEST) || defined(SPLIT)
- *logofs << "handleSplitEnable: WARNING! Disabling load "
- << "and save with an old proxy version.\n"
- << logofs_flush;
- #endif
-
- splitState_.save = 0;
- splitState_.load = 0;
- }
- }
-
//
// Allocate and free the shared memory
// support resources.
diff --git a/nxcomp/ServerProxy.cpp b/nxcomp/src/ServerProxy.cpp
index 0a72fc301..28f94842a 100644
--- a/nxcomp/ServerProxy.cpp
+++ b/nxcomp/src/ServerProxy.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <unistd.h>
#include "NXalert.h"
@@ -51,10 +63,10 @@ ServerProxy::ServerProxy(int proxyFd) : Proxy(proxyFd)
xServerAddr_ = NULL;
xServerDisplay_ = NULL;
- cupsServerPort_ = -1;
- smbServerPort_ = -1;
- mediaServerPort_ = -1;
- httpServerPort_ = -1;
+ cupsServerPort_ = NULL;
+ smbServerPort_ = NULL;
+ mediaServerPort_ = NULL;
+ httpServerPort_ = NULL;
fontServerPort_ = NULL;
@@ -101,8 +113,11 @@ void ServerProxy::handleDisplayConfiguration(const char *xServerDisplay, int xSe
#endif
}
-void ServerProxy::handlePortConfiguration(int cupsServerPort, int smbServerPort, int mediaServerPort,
- int httpServerPort, const char *fontServerPort)
+void ServerProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort,
+ ChannelEndPoint &smbServerPort,
+ ChannelEndPoint &mediaServerPort,
+ ChannelEndPoint &httpServerPort,
+ const char *fontServerPort)
{
cupsServerPort_ = cupsServerPort;
smbServerPort_ = smbServerPort;
@@ -161,22 +176,23 @@ int ServerProxy::handleNewConnectionFromProxy(T_channel_type type, int channelId
}
case channel_cups:
{
- return handleNewGenericConnectionFromProxy(channelId, channel_cups, "localhost",
+ return handleNewGenericConnectionFromProxy(channelId, channel_cups,
cupsServerPort_, "CUPS");
}
case channel_smb:
{
- return handleNewGenericConnectionFromProxy(channelId, channel_smb, getComputerName(),
+ smbServerPort_.setDefaultTCPInterface(1);
+ return handleNewGenericConnectionFromProxy(channelId, channel_smb,
smbServerPort_, "SMB");
}
case channel_media:
{
- return handleNewGenericConnectionFromProxy(channelId, channel_media, "localhost",
+ return handleNewGenericConnectionFromProxy(channelId, channel_media,
mediaServerPort_, "media");
}
case channel_http:
{
- return handleNewGenericConnectionFromProxy(channelId, channel_http, getComputerName(),
+ return handleNewGenericConnectionFromProxy(channelId, channel_http,
httpServerPort_, "HTTP");
}
case channel_slave:
diff --git a/nxcomp/ServerProxy.h b/nxcomp/src/ServerProxy.h
index 8c4a88410..e169c4aec 100644
--- a/nxcomp/ServerProxy.h
+++ b/nxcomp/src/ServerProxy.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ServerProxy_H
@@ -24,6 +32,7 @@
#include "Proxy.h"
#include "Misc.h"
+#include "ChannelEndPoint.h"
//
// Set the verbosity level.
@@ -43,8 +52,11 @@ class ServerProxy : public Proxy
virtual void handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily,
sockaddr *xServerAddr, unsigned int xServerAddrLength);
- virtual void handlePortConfiguration(int cupsServerPort, int smbServerPort, int mediaServerPort,
- int httpServerPort, const char *fontServerPort);
+ virtual void handlePortConfiguration(ChannelEndPoint &cupsServerPort,
+ ChannelEndPoint &smbServerPort,
+ ChannelEndPoint &mediaServerPort,
+ ChannelEndPoint &httpServerPort,
+ const char *fontServerPort);
protected:
@@ -102,18 +114,13 @@ class ServerProxy : public Proxy
virtual int checkLocalChannelMap(int channelId)
{
- if (control -> isProtoStep7() == 1)
- {
- return ((channelId & control -> ChannelMask) == 0);
- }
- else
- {
- return 0;
- }
+ // Since ProtoStep7 (#issue 108)
+ return ((channelId & control -> ChannelMask) == 0);
}
private:
+ // FIXME: Use a ChannelEndPoint object also for the X server!
int xServerAddrFamily_;
sockaddr *xServerAddr_;
unsigned int xServerAddrLength_;
@@ -130,10 +137,10 @@ class ServerProxy : public Proxy
// TCP connections.
//
- int cupsServerPort_;
- int smbServerPort_;
- int mediaServerPort_;
- int httpServerPort_;
+ ChannelEndPoint cupsServerPort_;
+ ChannelEndPoint smbServerPort_;
+ ChannelEndPoint mediaServerPort_;
+ ChannelEndPoint httpServerPort_;
//
// It will have to be passed to the channel
diff --git a/nxcomp/ServerReadBuffer.cpp b/nxcomp/src/ServerReadBuffer.cpp
index 53c1dec57..277b85216 100644
--- a/nxcomp/ServerReadBuffer.cpp
+++ b/nxcomp/src/ServerReadBuffer.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ServerReadBuffer.h"
#include "ServerChannel.h"
@@ -46,7 +58,7 @@ unsigned int ServerReadBuffer::suggestedLength(unsigned int pendingLength)
//
// Even if the readable data is not
// enough to make a complete message,
- // resize the buffer to accomodate
+ // resize the buffer to accommodate
// it all.
//
diff --git a/nxcomp/ServerReadBuffer.h b/nxcomp/src/ServerReadBuffer.h
index 438e2f0da..d6c207ead 100644
--- a/nxcomp/ServerReadBuffer.h
+++ b/nxcomp/src/ServerReadBuffer.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ServerReadBuffer_H
diff --git a/nxcomp/ServerStore.cpp b/nxcomp/src/ServerStore.cpp
index b0e13b1ad..8123b6de0 100644
--- a/nxcomp/ServerStore.cpp
+++ b/nxcomp/src/ServerStore.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ServerStore.h"
//
diff --git a/nxcomp/ServerStore.h b/nxcomp/src/ServerStore.h
index 8df1f1e9c..dbbb968e5 100644
--- a/nxcomp/ServerStore.h
+++ b/nxcomp/src/ServerStore.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ServerStore_H
diff --git a/nxcomp/SetClipRectangles.cpp b/nxcomp/src/SetClipRectangles.cpp
index 8774744fb..b43cea938 100644
--- a/nxcomp/SetClipRectangles.cpp
+++ b/nxcomp/src/SetClipRectangles.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "SetClipRectangles.h"
#include "ClientCache.h"
diff --git a/nxcomp/SetClipRectangles.h b/nxcomp/src/SetClipRectangles.h
index 06b4421f5..a2245360c 100644
--- a/nxcomp/SetClipRectangles.h
+++ b/nxcomp/src/SetClipRectangles.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef SetClipRectangles_H
diff --git a/nxcomp/SetUnpackAlpha.cpp b/nxcomp/src/SetUnpackAlpha.cpp
index a0dd1fc2e..5a352d26a 100644
--- a/nxcomp/SetUnpackAlpha.cpp
+++ b/nxcomp/src/SetUnpackAlpha.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "SetUnpackAlpha.h"
#include "ClientCache.h"
@@ -44,7 +56,6 @@ SetUnpackAlphaStore::SetUnpackAlphaStore(StaticCompressor *compressor)
{
enableCache = SETUNPACKALPHA_ENABLE_CACHE;
enableData = SETUNPACKALPHA_ENABLE_DATA;
- enableSplit = SETUNPACKALPHA_ENABLE_SPLIT_IF_PROTO_STEP_7;
enableCompress = SETUNPACKALPHA_ENABLE_COMPRESS_IF_PROTO_STEP_7;
dataLimit = SETUNPACKALPHA_DATA_LIMIT;
@@ -54,10 +65,8 @@ SetUnpackAlphaStore::SetUnpackAlphaStore(StaticCompressor *compressor)
cacheThreshold = SETUNPACKALPHA_CACHE_THRESHOLD;
cacheLowerThreshold = SETUNPACKALPHA_CACHE_LOWER_THRESHOLD;
- if (control -> isProtoStep8() == 1)
- {
- enableSplit = SETUNPACKALPHA_ENABLE_SPLIT_IF_PROTO_STEP_8;
- }
+ // Since ProtoStep8 (#issue 108)
+ enableSplit = SETUNPACKALPHA_ENABLE_SPLIT_IF_PROTO_STEP_8;
messages_ -> resize(cacheSlots);
diff --git a/nxcomp/SetUnpackAlpha.h b/nxcomp/src/SetUnpackAlpha.h
index 2e32a6590..54714efaa 100644
--- a/nxcomp/SetUnpackAlpha.h
+++ b/nxcomp/src/SetUnpackAlpha.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef SetUnpackAlpha_H
@@ -36,18 +44,14 @@
#define SETUNPACKALPHA_ENABLE_CACHE 1
#define SETUNPACKALPHA_ENABLE_DATA 1
-#define SETUNPACKALPHA_ENABLE_SPLIT 0
-#define SETUNPACKALPHA_ENABLE_COMPRESS 1
#define SETUNPACKALPHA_DATA_LIMIT 16384
-#define SETUNPACKALPHA_DATA_OFFSET 8
#define SETUNPACKALPHA_CACHE_SLOTS 2000
#define SETUNPACKALPHA_CACHE_THRESHOLD 10
#define SETUNPACKALPHA_CACHE_LOWER_THRESHOLD 5
#define SETUNPACKALPHA_DATA_OFFSET_IF_PROTO_STEP_7 16
-#define SETUNPACKALPHA_ENABLE_SPLIT_IF_PROTO_STEP_7 1
#define SETUNPACKALPHA_ENABLE_COMPRESS_IF_PROTO_STEP_7 0
#define SETUNPACKALPHA_ENABLE_SPLIT_IF_PROTO_STEP_8 0
diff --git a/nxcomp/SetUnpackColormap.cpp b/nxcomp/src/SetUnpackColormap.cpp
index d522d328e..2c9bba1bd 100644
--- a/nxcomp/SetUnpackColormap.cpp
+++ b/nxcomp/src/SetUnpackColormap.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "SetUnpackColormap.h"
#include "ClientCache.h"
@@ -44,7 +56,6 @@ SetUnpackColormapStore::SetUnpackColormapStore(StaticCompressor *compressor)
{
enableCache = SETUNPACKCOLORMAP_ENABLE_CACHE;
enableData = SETUNPACKCOLORMAP_ENABLE_DATA;
- enableSplit = SETUNPACKCOLORMAP_ENABLE_SPLIT;
enableCompress = SETUNPACKCOLORMAP_ENABLE_COMPRESS_IF_PROTO_STEP_7;
dataLimit = SETUNPACKCOLORMAP_DATA_LIMIT;
@@ -54,10 +65,8 @@ SetUnpackColormapStore::SetUnpackColormapStore(StaticCompressor *compressor)
cacheThreshold = SETUNPACKCOLORMAP_CACHE_THRESHOLD;
cacheLowerThreshold = SETUNPACKCOLORMAP_CACHE_LOWER_THRESHOLD;
- if (control -> isProtoStep8() == 1)
- {
- enableSplit = SETUNPACKCOLORMAP_ENABLE_SPLIT_IF_PROTO_STEP_8;
- }
+ // Since ProtoStep8 (#issue 108)
+ enableSplit = SETUNPACKCOLORMAP_ENABLE_SPLIT_IF_PROTO_STEP_8;
messages_ -> resize(cacheSlots);
diff --git a/nxcomp/SetUnpackColormap.h b/nxcomp/src/SetUnpackColormap.h
index 53277b3f0..779366531 100644
--- a/nxcomp/SetUnpackColormap.h
+++ b/nxcomp/src/SetUnpackColormap.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef SetUnpackColormap_H
@@ -36,11 +44,8 @@
#define SETUNPACKCOLORMAP_ENABLE_CACHE 1
#define SETUNPACKCOLORMAP_ENABLE_DATA 1
-#define SETUNPACKCOLORMAP_ENABLE_SPLIT 1
-#define SETUNPACKCOLORMAP_ENABLE_COMPRESS 1
#define SETUNPACKCOLORMAP_DATA_LIMIT 4096
-#define SETUNPACKCOLORMAP_DATA_OFFSET 8
#define SETUNPACKCOLORMAP_CACHE_SLOTS 2000
#define SETUNPACKCOLORMAP_CACHE_THRESHOLD 5
diff --git a/nxcomp/SetUnpackGeometry.cpp b/nxcomp/src/SetUnpackGeometry.cpp
index 67b79a410..edff6a544 100644
--- a/nxcomp/SetUnpackGeometry.cpp
+++ b/nxcomp/src/SetUnpackGeometry.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "SetUnpackGeometry.h"
#include "ClientCache.h"
diff --git a/nxcomp/SetUnpackGeometry.h b/nxcomp/src/SetUnpackGeometry.h
index 3a8224dfb..96104f57f 100644
--- a/nxcomp/SetUnpackGeometry.h
+++ b/nxcomp/src/SetUnpackGeometry.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef SetUnpackGeometry_H
diff --git a/nxcomp/ShapeExtension.cpp b/nxcomp/src/ShapeExtension.cpp
index daa19fbb4..2ee2b67db 100644
--- a/nxcomp/ShapeExtension.cpp
+++ b/nxcomp/src/ShapeExtension.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ShapeExtension.h"
#include "ClientCache.h"
@@ -45,12 +57,9 @@ ShapeExtensionStore::ShapeExtensionStore(StaticCompressor *compressor)
enableCache = SHAPEEXTENSION_ENABLE_CACHE;
enableData = SHAPEEXTENSION_ENABLE_DATA;
enableSplit = SHAPEEXTENSION_ENABLE_SPLIT;
- enableCompress = SHAPEEXTENSION_ENABLE_COMPRESS;
- if (control -> isProtoStep7() == 1)
- {
- enableCompress = SHAPEEXTENSION_ENABLE_COMPRESS_IF_PROTO_STEP_7;
- }
+ // Since ProtoStep7 (#issue 108)
+ enableCompress = SHAPEEXTENSION_ENABLE_COMPRESS_IF_PROTO_STEP_7;
dataLimit = SHAPEEXTENSION_DATA_LIMIT;
dataOffset = SHAPEEXTENSION_DATA_OFFSET;
diff --git a/nxcomp/ShapeExtension.h b/nxcomp/src/ShapeExtension.h
index 32c3b55ef..4dd636847 100644
--- a/nxcomp/ShapeExtension.h
+++ b/nxcomp/src/ShapeExtension.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef ShapeExtension_H
@@ -37,7 +45,6 @@
#define SHAPEEXTENSION_ENABLE_CACHE 1
#define SHAPEEXTENSION_ENABLE_DATA 1
#define SHAPEEXTENSION_ENABLE_SPLIT 0
-#define SHAPEEXTENSION_ENABLE_COMPRESS 1
#define SHAPEEXTENSION_DATA_LIMIT 3200
#define SHAPEEXTENSION_DATA_OFFSET 20
diff --git a/nxcomp/Socket.cpp b/nxcomp/src/Socket.cpp
index ea00a9b4e..8be04d76d 100644
--- a/nxcomp/Socket.cpp
+++ b/nxcomp/src/Socket.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <sys/types.h>
#include <sys/utsname.h>
diff --git a/nxcomp/Socket.h b/nxcomp/src/Socket.h
index 27c330850..77837a115 100644
--- a/nxcomp/Socket.h
+++ b/nxcomp/src/Socket.h
@@ -1,23 +1,35 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Socket_H
#define Socket_H
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
@@ -27,6 +39,12 @@
#include <sys/filio.h>
#endif
+#ifdef HAVE_IN_ADDR_T
+#define IN_ADDR_T in_addr_t
+#else
+#define IN_ADDR_T unsigned
+#endif
+
//
// Set socket options.
//
diff --git a/nxcomp/Split.cpp b/nxcomp/src/Split.cpp
index 50627e793..e2fea97cc 100644
--- a/nxcomp/Split.cpp
+++ b/nxcomp/src/Split.cpp
@@ -1,22 +1,34 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <unistd.h>
-#include <string.h>
+#include <cstring>
#include <sys/stat.h>
#include <sys/types.h>
#include <utime.h>
@@ -748,27 +760,8 @@ int SplitStore::start(DecodeBuffer &decodeBuffer)
// Get the compressed size.
//
- if (control -> isProtoStep7() == 1)
- {
- decodeBuffer.decodeValue(compressedSize, 32, 14);
- }
- else
- {
- //
- // As we can't refuse to handle the decoding
- // of the split message when connected to an
- // old proxy version, we need to decode this
- // in a way that is compatible.
- //
-
- unsigned int diffSize;
-
- decodeBuffer.decodeValue(diffSize, 32, 14);
-
- split -> store_ -> lastResize += diffSize;
-
- compressedSize = split -> store_ -> lastResize;
- }
+ // Since ProtoStep7 (#issue 108)
+ decodeBuffer.decodeValue(compressedSize, 32, 14);
split -> store_ -> validateSize(split -> d_size_, compressedSize);
diff --git a/nxcomp/Split.h b/nxcomp/src/Split.h
index c9a3c9ad3..ee5eae7fe 100644
--- a/nxcomp/Split.h
+++ b/nxcomp/src/Split.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Split_H
diff --git a/nxcomp/StaticCompressor.cpp b/nxcomp/src/StaticCompressor.cpp
index b30e61a80..b47193354 100644
--- a/nxcomp/StaticCompressor.cpp
+++ b/nxcomp/src/StaticCompressor.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Z.h"
#include "Misc.h"
#include "Control.h"
diff --git a/nxcomp/StaticCompressor.h b/nxcomp/src/StaticCompressor.h
index 3e5b25ca1..e0b81a527 100644
--- a/nxcomp/StaticCompressor.h
+++ b/nxcomp/src/StaticCompressor.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef StaticCompressor_H
diff --git a/nxcomp/Statistics.cpp b/nxcomp/src/Statistics.cpp
index 294518fb7..68673ffc1 100644
--- a/nxcomp/Statistics.cpp
+++ b/nxcomp/src/Statistics.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include "Statistics.h"
@@ -349,14 +361,14 @@ void Statistics::updateBitrate(int bytes)
#ifdef DEBUG
*logofs << "Statistics: Difference since previous timestamp is "
- << diffFramesInMs << " Ms.\n" << logofs_flush;
+ << diffFramesInMs << " ms.\n" << logofs_flush;
#endif
if (diffFramesInMs > 0)
{
#ifdef DEBUG
*logofs << "Statistics: Removing " << diffFramesInMs
- << " Ms in short and long time frame.\n"
+ << " ms in short and long time frame.\n"
<< logofs_flush;
#endif
@@ -1739,7 +1751,7 @@ int Statistics::getTimeStats(int type, char *&buffer)
char format[FORMAT_LENGTH];
- sprintf(format, "\ntime: %.0f Ms idle, %.0f Ms (%.0f Ms in read, %.0f Ms in write) running.\n\n",
+ sprintf(format, "\ntime: %.0f ms idle, %.0fms (%.0f ms in read, %.0f ms in write) running.\n\n",
transportData -> idleTime_, transportData -> readTime_,
transportData -> readTime_ - transportData -> writeTime_,
transportData -> writeTime_);
diff --git a/nxcomp/Statistics.h b/nxcomp/src/Statistics.h
index 44ff8834f..1ffb6b5d6 100644
--- a/nxcomp/Statistics.h
+++ b/nxcomp/src/Statistics.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Statistics_H
diff --git a/nxcomp/Timestamp.cpp b/nxcomp/src/Timestamp.cpp
index 295eb65cf..e7e0c494a 100644
--- a/nxcomp/Timestamp.cpp
+++ b/nxcomp/src/Timestamp.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Timestamp.h"
//
diff --git a/nxcomp/Timestamp.h b/nxcomp/src/Timestamp.h
index 69953988a..bb9b243db 100644
--- a/nxcomp/Timestamp.h
+++ b/nxcomp/src/Timestamp.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Timestamp_H
@@ -127,7 +135,7 @@ inline T_timestamp getTimestamp()
if (diffTs > DRIFT_TIMESTAMP)
{
*logofs << "Timestamp: WARNING! Time difference since the "
- << "current timestamp is " << diffTs << " Ms.\n"
+ << "current timestamp is " << diffTs << "ms.\n"
<< logofs_flush;
}
@@ -285,7 +293,7 @@ inline T_timestamp getNewTimestamp()
if (diffTs > DRIFT_TIMESTAMP)
{
*logofs << "Timestamp: WARNING! Time difference since the "
- << "old timestamp is " << diffTs << " Ms.\n"
+ << "old timestamp is " << diffTs << "ms.\n"
<< logofs_flush;
}
diff --git a/nxcomp/TranslateCoords.cpp b/nxcomp/src/TranslateCoords.cpp
index e67e1dac5..f61caea47 100644
--- a/nxcomp/TranslateCoords.cpp
+++ b/nxcomp/src/TranslateCoords.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "TranslateCoords.h"
#include "ClientCache.h"
diff --git a/nxcomp/TranslateCoords.h b/nxcomp/src/TranslateCoords.h
index 3f21b243c..997d079e1 100644
--- a/nxcomp/TranslateCoords.h
+++ b/nxcomp/src/TranslateCoords.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef TranslateCoords_H
diff --git a/nxcomp/Transport.cpp b/nxcomp/src/Transport.cpp
index 4b4967826..63e26bae6 100644
--- a/nxcomp/Transport.cpp
+++ b/nxcomp/src/Transport.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@@ -856,7 +868,7 @@ int Transport::wait(int timeout) const
#ifdef TEST
*logofs << "Transport: There are " << available
<< " bytes on FD#" << fd_ << " after "
- << diffTs << " Ms.\n" << logofs_flush;
+ << diffTs << " ms.\n" << logofs_flush;
#endif
return available;
@@ -921,13 +933,13 @@ int Transport::wait(int timeout) const
{
*logofs << "Transport: No data available on FD#" << fd_
<< " after " << diffTimestamp(startTs, nowTs)
- << " Ms.\n" << logofs_flush;
+ << " ms.\n" << logofs_flush;
}
else
{
*logofs << "Transport: Data became available on FD#" << fd_
<< " after " << diffTimestamp(startTs, nowTs)
- << " Ms.\n" << logofs_flush;
+ << " ms.\n" << logofs_flush;
}
#endif
}
@@ -1400,7 +1412,7 @@ int ProxyTransport::read(unsigned char *data, unsigned int size)
<< logofs_flush;
#endif
- int result = inflate(&r_stream_, Z_SYNC_FLUSH);
+ result = inflate(&r_stream_, Z_SYNC_FLUSH);
#ifdef INSPECT
*logofs << "ProxyTransport: Called inflate() result is "
diff --git a/nxcomp/Transport.h b/nxcomp/src/Transport.h
index 2f313b29f..4ae0e3c25 100644
--- a/nxcomp/Transport.h
+++ b/nxcomp/src/Transport.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Transport_H
@@ -226,7 +234,7 @@ class Transport
protected:
//
- // Make room in the buffer to accomodate
+ // Make room in the buffer to accommodate
// at least size bytes.
//
@@ -405,9 +413,9 @@ class AgentTransport : public Transport
// These two should never be called.
//
- virtual int flush();
+ virtual int flush() __attribute__((noreturn));
- virtual int drain(int limit, int timeout);
+ virtual int drain(int limit, int timeout) __attribute((noreturn));
//
// Same as in the base class.
diff --git a/nxcomp/Types.h b/nxcomp/src/Types.h
index 05f62bd00..e82664c81 100644
--- a/nxcomp/Types.h
+++ b/nxcomp/src/Types.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Types_H
@@ -55,6 +63,9 @@ class T_data : public vector < unsigned char >
return &*(vector < unsigned char >::begin());
}
+ // Avoid overriding clear() when using libc++. Fiddling with STL internals
+ // doesn't really seem like a good idea to me anyway.
+ #ifndef _LIBCPP_VECTOR
void clear()
{
#if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H)
@@ -95,12 +106,16 @@ class T_data : public vector < unsigned char >
#endif /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */
}
+ #endif /* #ifdef _LIBCPP_VECTOR */
};
class T_messages : public vector < Message * >
{
public:
+ // Avoid overriding clear() when using libc++. Fiddling with STL internals
+ // doesn't really seem like a good idea to me anyway.
+ #ifndef _LIBCPP_VECTOR
void clear()
{
#if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H)
@@ -141,6 +156,7 @@ class T_messages : public vector < Message * >
#endif /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */
}
+ #endif /* #ifndef _LIBCPP_VECTOR */
};
typedef md5_byte_t * T_checksum;
@@ -171,7 +187,7 @@ typedef set < File *, T_older > T_files;
typedef list < int > T_list;
//
-// Used to accomodate data to be read and
+// Used to accommodate data to be read and
// written to a socket.
//
@@ -191,18 +207,18 @@ T_buffer;
// received at the decoding side.
//
+// Since ProtoStep8 (#issue 108)
enum T_store_action
{
is_hit,
is_added,
is_discarded,
- is_removed,
- is_added_compat = 0,
- is_hit_compat = 1
+ is_removed
};
-#define IS_HIT (control -> isProtoStep8() == 1 ? is_hit : is_hit_compat)
-#define IS_ADDED (control -> isProtoStep8() == 1 ? is_added : is_added_compat)
+// Since ProtoStep8 (#issue 108)
+#define IS_HIT is_hit
+#define IS_ADDED is_added
enum T_checksum_action
{
diff --git a/nxcomp/Unpack.cpp b/nxcomp/src/Unpack.cpp
index 5fc494465..e63e836f0 100644
--- a/nxcomp/Unpack.cpp
+++ b/nxcomp/src/Unpack.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Misc.h"
#include "Unpack.h"
diff --git a/nxcomp/Unpack.h b/nxcomp/src/Unpack.h
index 65a410fb6..faaa41d82 100644
--- a/nxcomp/Unpack.h
+++ b/nxcomp/src/Unpack.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Unpack_H
diff --git a/nxcomp/Vars.c b/nxcomp/src/Vars.c
index 0d93a6dc6..685969677 100644
--- a/nxcomp/Vars.c
+++ b/nxcomp/src/Vars.c
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifdef __cplusplus
diff --git a/nxcomp/src/Version.c b/nxcomp/src/Version.c
new file mode 100644
index 000000000..509bd8344
--- /dev/null
+++ b/nxcomp/src/Version.c
@@ -0,0 +1,101 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2015 Qindel Formacion y Servicios SL. */
+/* */
+/* This program is free software; you can redistribute it and/or modify */
+/* it under the terms of the GNU General Public License Version 2, as */
+/* published by the Free Software Foundation. */
+/* */
+/* This program is distributed in the hope that it will be useful, but */
+/* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA- */
+/* BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General */
+/* Public License for more details. */
+/* */
+/* You should have received a copy of the GNU General Public License */
+/* along with this program; if not, you can request a copy from Qindel */
+/* or write to the Free Software Foundation, Inc., 51 Franklin Street, */
+/* Fifth Floor, Boston, MA 02110-1301 USA. */
+/* */
+/* All rights reserved. */
+/* */
+/**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "NX.h"
+
+
+static int _NXVersionMajor = -1;
+static int _NXVersionMinor = -1;
+static int _NXVersionPatch = -1;
+static int _NXVersionMaintenancePatch = -1;
+
+
+const char* NXVersion() {
+ const char *version = VERSION;
+ return version;
+}
+
+void _parseNXVersion() {
+ char version[32];
+ int i;
+ strcpy(version, VERSION);
+
+ char *value;
+ /* Reset values to 0 if undefined */
+ _NXVersionMajor = _NXVersionMinor = _NXVersionPatch = _NXVersionMaintenancePatch = 0;
+
+
+#define NXVERSIONSEPARATOR "."
+ value = strtok(version, NXVERSIONSEPARATOR);
+
+ for (i = 0; value != NULL && i < 4; i++)
+ {
+ switch (i)
+ {
+ case 0:
+ _NXVersionMajor = atoi(value);
+ break;
+
+ case 1:
+ _NXVersionMinor = atoi(value);
+ break;
+
+ case 2:
+ _NXVersionPatch = atoi(value);
+ break;
+
+ case 3:
+ _NXVersionMaintenancePatch = atoi(value);
+ break;
+ }
+
+ value = strtok(NULL, NXVERSIONSEPARATOR);
+ }
+}
+
+int NXMajorVersion() {
+ if (_NXVersionMajor == -1)
+ _parseNXVersion();
+ return _NXVersionMajor;
+}
+int NXMinorVersion() {
+ if (_NXVersionMinor == -1)
+ _parseNXVersion();
+ return _NXVersionMinor;
+}
+int NXPatchVersion() {
+ if (_NXVersionPatch == -1)
+ _parseNXVersion();
+ return _NXVersionPatch;
+}
+int NXMaintenancePatchVersion() {
+ if (_NXVersionMaintenancePatch == -1)
+ _parseNXVersion();
+ return _NXVersionMaintenancePatch;
+}
diff --git a/nxcomp/WriteBuffer.cpp b/nxcomp/src/WriteBuffer.cpp
index ac38fe688..70b4e3b53 100644
--- a/nxcomp/WriteBuffer.cpp
+++ b/nxcomp/src/WriteBuffer.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stddef.h>
#include <string.h>
#include <unistd.h>
diff --git a/nxcomp/WriteBuffer.h b/nxcomp/src/WriteBuffer.h
index 4673cecee..ce408e210 100644
--- a/nxcomp/WriteBuffer.h
+++ b/nxcomp/src/WriteBuffer.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef WriteBuffer_H
diff --git a/nxcomp/src/XidCache.cpp b/nxcomp/src/XidCache.cpp
new file mode 100644
index 000000000..ab6574cc9
--- /dev/null
+++ b/nxcomp/src/XidCache.cpp
@@ -0,0 +1,51 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
+/* */
+/* NXCOMP, NX protocol compression and NX extensions to this software */
+/* are copyright of the aforementioned persons and companies. */
+/* */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
+/* */
+/* All rights reserved. */
+/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
+/**************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "Control.h"
+
+#include "XidCache.h"
+
+XidCache::XidCache()
+{
+ for (int i = 0; i < 256; i++)
+ {
+ base_[i] = new IntCache(8);
+ }
+
+ slot_ = 0;
+ last_ = 0;
+}
+
+XidCache::~XidCache()
+{
+ for (int i = 0; i < 256; i++)
+ {
+ delete base_[i];
+ }
+}
diff --git a/nxcomp/XidCache.h b/nxcomp/src/XidCache.h
index 78a94d8d0..8a09ef9b1 100644
--- a/nxcomp/XidCache.h
+++ b/nxcomp/src/XidCache.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef XidCache_H
diff --git a/nxcomp/Z.cpp b/nxcomp/src/Z.cpp
index e6c93cd10..af3b380f2 100644
--- a/nxcomp/Z.cpp
+++ b/nxcomp/src/Z.cpp
@@ -1,20 +1,32 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "Z.h"
#include "Misc.h"
diff --git a/nxcomp/Z.h b/nxcomp/src/Z.h
index d7f7fa185..3a6d684c2 100644
--- a/nxcomp/Z.h
+++ b/nxcomp/src/Z.h
@@ -1,18 +1,26 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */
+/* Copyright (c) 2008-2014 Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> */
+/* Copyright (c) 2014-2016 Ulrich Sibiller <uli42@gmx.de> */
+/* Copyright (c) 2014-2016 Mihai Moldovan <ionic@ionic.de> */
+/* Copyright (c) 2011-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>*/
+/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */
/* */
/* NXCOMP, NX protocol compression and NX extensions to this software */
-/* are copyright of NoMachine. Redistribution and use of the present */
-/* software is allowed according to terms specified in the file LICENSE */
-/* which comes in the source distribution. */
+/* are copyright of the aforementioned persons and companies. */
/* */
-/* Check http://www.nomachine.com/licensing.html for applicability. */
-/* */
-/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* Redistribution and use of the present software is allowed according */
+/* to terms specified in the file LICENSE.nxcomp which comes in the */
+/* source distribution. */
/* */
/* All rights reserved. */
/* */
+/* NOTE: This software has received contributions from various other */
+/* contributors, only the core maintainers and supporters are listed as */
+/* copyright holders. Please contact us, if you feel you should be listed */
+/* as copyright holder, as well. */
+/* */
/**************************************************************************/
#ifndef Z_H
diff --git a/nxcomp/test/Makefile.am b/nxcomp/test/Makefile.am
new file mode 100644
index 000000000..412b8ea94
--- /dev/null
+++ b/nxcomp/test/Makefile.am
@@ -0,0 +1,22 @@
+NULL =
+
+noinst_PROGRAMS = logging_test
+EXTRA_DIST = logging_test
+
+AM_CPPFLAGS = -I$(top_srcdir)/src
+AM_CXXFLAGS = \
+ @PTHREAD_CFLAGS@ \
+ $(NULL)
+
+logging_test_SOURCES = logging_test.cpp
+logging_test_LDADD = \
+ $(top_srcdir)/src/.libs/libXcomp.a \
+ @PTHREAD_LIBS@ \
+ $(NULL)
+
+logging_test_LDFLAGS = \
+ $(PTHREAD_LDFLAGS) \
+ $(NULL)
+
+check: all
+ ./logging_test
diff --git a/nxcomp/test/logging_test.cpp b/nxcomp/test/logging_test.cpp
new file mode 100644
index 000000000..7e2d7d213
--- /dev/null
+++ b/nxcomp/test/logging_test.cpp
@@ -0,0 +1,224 @@
+#include <cstddef>
+#include <pthread.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <cstdlib>
+#include <ctime>
+#include <climits>
+#include <vector>
+#include <cstring>
+
+#include "logging_test.h"
+
+Faulty_Logger faulty_logger;
+NXLog good_logger;
+
+void print_sigmask () {
+ sigset_t orig_mask;
+ sigemptyset (&orig_mask);
+
+ pthread_sigmask (SIG_SETMASK, NULL, &orig_mask);
+
+ bool empty = true;
+ for (std::size_t i = 0; i < NSIG; ++i) {
+ if (sigismember (&orig_mask, i)) {
+ nxdbg_good << "Signal i (" << i << ") in signal mask." << std::endl;
+ empty = false;
+ }
+ }
+
+ if (empty) {
+ nxdbg_good << "Signal mask empty.";
+ }
+}
+
+void* log_task (void* /* unused */) {
+ /* print_sigmask (); */
+
+ for (std::size_t i = 0; i < 10; ++i) {
+ nxinfo << "Log message " << i << std::endl;
+ }
+}
+
+void sig_handler (int signo) {
+ nxinfo << "Received signal " << signo << std::endl;
+}
+
+void setup_faulty_logger () {
+ faulty_logger.log_level (true);
+ faulty_logger.log_unix_time (false);
+ faulty_logger.log_time (true);
+ faulty_logger.log_location (true);
+ faulty_logger.log_thread_id (true);
+ faulty_logger.level (NXDEBUG);
+}
+
+void setup_good_logger () {
+ good_logger.log_level (true);
+ good_logger.log_unix_time (false);
+ good_logger.log_time (true);
+ good_logger.log_location (true);
+ good_logger.log_thread_id (true);
+ good_logger.level (NXDEBUG);
+}
+
+pthread_t spawn_thread () {
+ pthread_t thread_id;
+ int pthread_ret;
+
+ sigset_t block_mask, orig_mask;
+ sigemptyset (&orig_mask);
+ sigfillset (&block_mask);
+
+ pthread_sigmask (SIG_BLOCK, &block_mask, &orig_mask);
+
+ pthread_ret = pthread_create (&thread_id, NULL, log_task, NULL);
+
+ pthread_sigmask (SIG_SETMASK, &orig_mask, NULL);
+
+ return (thread_id);
+}
+
+void install_signal_handler () {
+ struct sigaction sa;
+ sa.sa_handler = sig_handler;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = SA_RESTART;
+
+ if (-1 == sigaction (SIGUSR1, &sa, NULL)) {
+ nxerr_good << "Unable to install signal handler!" << std::endl;
+ }
+ else {
+ nxdbg_good << "Signal handler registered successfully for SIGUSR1." << std::endl;
+ }
+}
+
+void killing_process_work (pid_t parent_pid) {
+ /* Seed PRNG. */
+ std::srand (std::time (0));
+
+ for (std::size_t i = 0; i < 25; ++i) {
+ /* Sleep for 4 seconds + some random number up to a second. */
+ std::size_t rand_add = (std::rand () % 1000000);
+ usleep (4000000 + rand_add);
+
+ /* Send SIGUSR1 to parent process. */
+ nxdbg_good << "Sending SIGUSR1 (" << SIGUSR1 << ") to parent_pid (" << parent_pid << ")" << std::endl;
+
+ if (kill (parent_pid, SIGUSR1)) {
+ int saved_errno = errno;
+ nxerr_good << "Failed to deliver signal to parent, aborting." << std::endl;
+ nxerr_good << "Error " << saved_errno << ": " << strerror (saved_errno) << std::endl;
+ exit (EXIT_FAILURE);
+ }
+ }
+
+ exit (EXIT_SUCCESS);
+}
+
+void killing_process_init (int argc, char **argv) {
+ /* We're in the "killing process". */
+ pid_t parent_pid = getppid ();
+
+ setup_good_logger ();
+
+ for (std::size_t i = 0; i < argc; ++i) {
+ nxdbg_good << "argv[" << i << "]: " << argv[i] << std::endl;
+ }
+
+ char *end = NULL;
+
+ errno = 0;
+ long parent_pid_check = std::strtol (argv[1], &end, 0);
+
+ if ((errno == ERANGE) && (parent_pid_check == LONG_MAX)) {
+ /* Overflow, handle gracefully. */
+ parent_pid_check = 1;
+ }
+
+ if ((errno == ERANGE) && (parent_pid_check == LONG_MIN)) {
+ /* Underflow, handle gracefully. */
+ parent_pid_check = 1;
+ }
+
+ if (*end) {
+ /* Conversion error (for inputs like "<number>X", end will point to X.) */
+ parent_pid_check = 1;
+ }
+
+ if (parent_pid != parent_pid_check) {
+ nxinfo_good << "Parent PID verification via first argument failed, trusting getppid ()." << std::endl;
+ }
+
+ killing_process_work (parent_pid);
+}
+
+int main (int argc, char **argv) {
+ if (argc > 1) {
+ killing_process_init (argc, argv);
+ }
+ else {
+ /* That's the main process. */
+
+ /* First, fork and create the "killing process". */
+ pid_t pid = fork ();
+
+ if (0 == pid) {
+ /* Child process. */
+ pid_t parent_pid = getppid ();
+
+ /* Prepare to pass-through parent PID. */
+ std::stringstream ss;
+ ss << parent_pid;
+
+ std::vector<std::string> new_argv;
+ new_argv.push_back (std::string (argv[0]));
+ new_argv.push_back (ss.str ());
+
+ std::vector<char *> new_argv_c_str;
+ for (std::vector<std::string>::iterator it = new_argv.begin (); it != new_argv.end (); ++it) {
+ const char *elem = (*it).c_str ();
+ new_argv_c_str.push_back (strndup (elem, std::strlen (elem)));
+ }
+
+ /* Add null pointer as last element. */
+ new_argv_c_str.push_back (0);
+
+ /* Relaunch, with argv[1] containing the ppid. */
+ if (0 != execvp (new_argv_c_str.front (), &(new_argv_c_str.front ()))) {
+ const int saved_errno = errno;
+ std::cerr << "Failed to start \"killing process\"! Panic!" << std::endl;
+ std::cerr << "System error: " << std::strerror (saved_errno) << std::endl;
+ exit (EXIT_FAILURE);
+ }
+ }
+ else if (0 > pid) {
+ const int saved_errno = errno;
+ std::cerr << "Error while forking main process! Panic!" << std::endl;
+ std::cerr << "System error: " << std::strerror (saved_errno) << std::endl;
+ exit (EXIT_FAILURE);
+ }
+ else {
+ /* Main process. */
+ /* Falls through to general code below. */
+ }
+ }
+
+ setup_faulty_logger ();
+
+ pthread_t thread_id = spawn_thread ();
+
+ setup_good_logger ();
+
+ install_signal_handler ();
+
+ /* print_sigmask (); */
+
+ log_task (NULL);
+
+ pthread_join (thread_id, NULL);
+
+ exit (EXIT_SUCCESS);
+}
diff --git a/nxcomp/test/logging_test.h b/nxcomp/test/logging_test.h
new file mode 100644
index 000000000..239fbfe2b
--- /dev/null
+++ b/nxcomp/test/logging_test.h
@@ -0,0 +1,121 @@
+#ifndef LOGGING_TEST_H
+#define LOGGING_TEST_H
+
+#include <unistd.h>
+
+#define INTERNAL_LOGGING_TEST
+#include "Log.h"
+
+class Faulty_Logger : public NXLog {
+ /* Copied from base class, inserted "fault" within critical section. */
+ using NXLog::flush;
+ void flush(per_thread_data *pdt)
+ {
+ sigset_t orig_signal_mask,
+ tmp_signal_mask;
+ sigemptyset(&orig_signal_mask);
+
+ sigfillset(&tmp_signal_mask);
+
+ pthread_sigmask(SIG_BLOCK, &tmp_signal_mask, &orig_signal_mask);
+
+ if (!pdt->buffer.empty ()) {
+ const std::string str = pdt->buffer.top()->str();
+
+ if (!str.empty())
+ {
+ pthread_mutex_lock(&output_lock_);
+ usleep (3000000);
+ (*stream()) << str;
+ pthread_mutex_unlock(&output_lock_);
+ }
+
+ pdt->buffer.pop();
+ }
+
+ pthread_sigmask(SIG_SETMASK, &orig_signal_mask, NULL);
+ }
+
+ template<typename T>
+ friend Faulty_Logger& operator<<(Faulty_Logger& out, const T& value);
+
+ friend Faulty_Logger& operator<< (Faulty_Logger& out, const NXLogStamp& value);
+};
+
+template <typename T>
+Faulty_Logger& operator<<(Faulty_Logger& out, const T& value) {
+ if ( out.will_log() ) {
+ if ( out.synchronized() ) {
+ // In synchronized mode, we buffer data until a newline, std::flush, or the buffer
+ // gets full. Then we dump the whole thing at once to the output stream, synchronizing
+ // with a mutex.
+ Faulty_Logger::per_thread_data *pdt = out.get_data();
+ assert (!pdt->buffer.empty ());
+ usleep (1000000);
+ (*pdt->buffer.top()) << value;
+
+ if ( ss_length(pdt->buffer.top()) >= out.thread_buffer_size_ || has_newline(value) )
+ out.flush();
+ }
+ else {
+ // In async mode we just dump data on the output stream as-is.
+ // Multithreaded code will have ugly output.
+ *(out.stream()) << value;
+ }
+ }
+
+ return out;
+}
+
+Faulty_Logger& operator<< (Faulty_Logger& out, const NXLogStamp& value)
+{
+ out.current_level( value.level() );
+ out.current_file( value.file() );
+
+ // Writing an NXLogStamp to the stream indicates the start of a new entry.
+ // If there's any content in the buffer, create a new entry in the output
+ // queue.
+ if ( out.synchronized() )
+ out.new_stack_entry();
+
+ out << out.stamp_to_string(value);
+
+ return out;
+}
+
+#undef nxdbg
+#undef nxinfo
+#undef nxwarn
+#undef nxerr
+#undef nxfatal
+
+#define nxdbg faulty_logger << nxstamp(NXDEBUG)
+#define nxinfo faulty_logger << nxstamp(NXINFO)
+#define nxwarn faulty_logger << nxstamp(NXWARNING)
+#define nxerr faulty_logger << nxstamp(NXERROR)
+#define nxfatal faulty_logger << nxstamp(NXFATAL)
+
+#define nxdbg_good good_logger << nxstamp(NXDEBUG)
+#define nxinfo_good good_logger << nxstamp(NXINFO)
+#define nxwarn_good good_logger << nxstamp(NXWARNING)
+#define nxerr_good good_logger << nxstamp(NXERROR)
+#define nxfatal_good good_logger << nxstamp(NXFATAL)
+
+/* Helper functions used by all component. */
+void print_sigmask ();
+void setup_faulty_logger ();
+void setup_good_logger ();
+
+/* Functions used by both main and auxiliary threads. */
+void* log_task (void* /* unused */);
+
+/* Functions used in main thread only. */
+pthread_t spawn_thread ();
+void install_signal_handler ();
+void sig_handler (int signo);
+
+/* Functions used by "killing" process. */
+void killing_process_init (int argc, char **argv);
+void killing_process_work (pid_t parent_pid);
+
+#endif /* !defined (LOGGING_TEST_H) */