diff options
Diffstat (limited to 'nxcomp')
25 files changed, 1 insertions, 3960 deletions
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/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/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/Makefile.in b/nxcomp/Makefile.in index d309c4949..93b644079 100644 --- a/nxcomp/Makefile.in +++ b/nxcomp/Makefile.in @@ -226,18 +226,7 @@ CXXSRC = Loop.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 + RenderTriangles.cpp MOBJ = $(MSRC:.c=.o) COBJ = $(CSRC:.c=.o) diff --git a/nxcomp/PositionCacheCompat.cpp b/nxcomp/PositionCacheCompat.cpp deleted file mode 100644 index dd301a0a4..000000000 --- a/nxcomp/PositionCacheCompat.cpp +++ /dev/null @@ -1,28 +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() -{ -} - -PositionCacheCompat::~PositionCacheCompat() -{ -} 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/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/RenderExtension.h b/nxcomp/RenderExtension.h index 2b616e1e5..7ccf54068 100644 --- a/nxcomp/RenderExtension.h +++ b/nxcomp/RenderExtension.h @@ -82,13 +82,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/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 */ |